The Tucson police officer who was shot in the head while responding to a burglary testified Friday he felt intense pain, saying it was as if he had been “kicked in the head by a mule.”

Testifying against the man accused of the shooting him, Tucson police Sgt. Robert Carpenter said, “I hear a loud noise, which I knew was a gunshot, and then I was knocked to the ground.”

Richard Mendoza is on trial in Pima County Superior Court on charges of shooting Carpenter in November 2012 and for burglary and multiple counts of illegally possessing a firearm.

Carpenter had responded to a midtown home where a burglar alarm had sounded. It was the second alarm at the house that night.

He described finding the sliding glass door at the home shattered when he arrived. Carpenter said he called for backup to help him search the home.

He and two other officers searched the house but found it empty, he said.

As the three officers left the house, however, a gunshot rang out from an unknown location, the bullet striking Carpenter’s head.

“I knew that I’d been shot from the moment it happened,” Carpenter said.

The other officers dragged Carpenter to a safe location and called for medical assistance.

At first, Carpenter said, he was aware of what was happening, but he rapidly began to lose cognition.

He spent three weeks in a hospital after the shooting. He said he suffered from diminished vision, loss of feeling on his left side and a loss of motor skills.

Doctors also removed a portion of his skull during the surgeries he underwent.

“It’s been a long recovery process since then,” he said.

Carpenter, a 13-year police veteran, recently returned to desk duty with the Tucson Police Department, although health concerns have not allowed him to take on the same patrol and sergeant’s duties he previously had.

Mendoza was arrested the day after the incident at a nearby hotel. At the time of his arrest, Mendoza had been out of jail for less than a month on separate burglary charges.

The trial is scheduled to continue on Tuesday in Judge Jane Eikleberry’s courtroom.

Contact reporter Patrick McNamara at 573-4241 or On Twitter @pm929.