A Longmont police officer shot a man once in the abdomen Monday afternoon after investigators say he pulled a realistic-looking pellet rifle out during a traffic stop at Elk Court and Lashley Street.

Deputy Public Safety Chief Craig Earhart said officers took 31-year-old Levi M. Rosales into custody shortly before 9 p.m., about four hours after the shooting.

Earhart said Rosales, who police found hiding in the rafters above a garage at a home on the 100 block of Telluride Place, “surrendered peacefully after some negotiation and persuasion.”

Rosales was transported to the Longmont United Hospital for treatment of his injuries, the released.

He was booked into the Boulder County Jail on suspicion of first-degree burglary, attempted first-degree assault, felony menacing and resisting arrest, with bond set at $500,000.

During the four hours from the initial incident to the time of Rosales capture, SWAT officers set up a perimeter and could be seen fanning out on streets around Telluride, and police brought an armored vehicle and robot to the scene.

Flash-bang grenades could be heard along with commands being given over a bullhorn.

During the search for the suspect, police used an automated phone calling system to notify people in the area, and they shut down a nearby youth center and the Ed & Ruth Lehman YMCA of Longmont at 950 Lashley St. Nearby residents were unable to get to their homes, but police had started letting them in about 45 minutes after Rosales’ capture.

The incident started after a traffic stop at 4:53 p.m. Monday. Earhart said the officer who shot Rosales, whose name wasn’t released Monday, had made contact with a red Cadillac that had been tied to a theft from a Carquest shop earlier in the day.

As the officer approached the car the suspect exited the vehicle armed with what appeared to be a hunting rifle with a scope, according to Earhart. Police later determined the weapon was a “realistic-looking scoped pellet rifle.”

The officer fired several shots at the suspect.

Police hadn’t been sure if Rosales had been hit during the shooting, but Earhart said he had fallen down and jumped back up before running away.

The officer has been placed on leave pending the outcome of the investigation and a ruling by the Boulder County District Attorney’s Office on whether the shooting was justified, Earhart said.

John Bear: 303-684-5212, bearj@timescall.com or twitter.com/johnbearwithme