SAN ANTONIO – A police officer in San Antonio died Friday of wounds suffered when he and his partner were shot by a man they intended to question about a vehicle break-in, police said.

Officer Miguel Moreno, a nine-year veteran of the police force, was shot in the head during the encounter Thursday. The gunman fired on Moreno and his partner, Officer Julio Cavazos, as they stepped out of their patrol car. Cavazos also was shot but returned fire and attempted to pull Moreno out of the line of fire.

Cavazos underwent surgery and is expected to recover, police Chief William McManus said during a news conference earlier Friday. The gunman died in the shootout.

The officers were patrolling north of downtown when they decided to question two men because they were near the vehicle that had been broken into, McManus said. He said the officers didn't consider the men suspects.

"I'm at a loss to describe what a tragedy this is," McManus said.

The gunman was shot in the buttocks and as he attempted to flee he suffered a head wound that may have been self-inflicted. Police identified the gunman Friday as Andrew Bice, 34. McManus said he might have come from Louisiana.

McManus said the second man was unaware that his companion would pull a weapon and has been cooperating with investigators. He was arrested on outstanding municipal warrants but released.

"All they were going to do was contact these two individuals, contact them to get their identification, in the event that anything did happen ...," McManus said. "And things went bad real quick."

Moreno's death brought people to police headquarters Friday, leaving flowers and notes of sympathy outside the entrance. "Blessed are the peacemakers," read one. "We back the blue," said another.

The mourners included 9-year-old Tony Alameda, who left flowers and knelt for prayer. The boy said his aim is to one day become a police officer.

Texas Gov. Greg Abbott on Friday ordered state flags lowered to half-staff across San Antonio through Monday in tribute to Moreno.

"This senseless act of violence against two courageous and committed law enforcement officers demonstrates the risk our men and women in blue face every day," Abbott said in a statement. "We owe Officer Moreno and Officer Julio Cavazos a great debt of gratitude for their service and bravery in the face of danger."

Thursday's incident follows a shooting in November in which a San Antonio police detective was killed. Benjamin Marconi, a 20-year veteran of the force, was sitting in his squad car writing a traffic ticket when a man walked up and shot him in the head. The suspect, identified as Otis Tyrone McKane, later told reporters he was angry about a child-custody fight and lashed out.

Download the Click2Houston news app in your app store to stay up-to-date with the latest news while you're on the go.

Sign up for KPRC 2 newsletters to get breaking news, sports, entertainment, contests and more delivered straight to your email inbox.