An almost nine-hour standoff ended just before midnight Sunday with the arrest of a San Bernardino man suspected of shooting at children gathering around an ice cream truck, then later at a SWAT armored vehicle.

A fire started in his house after authorities began firing “hot” or pyrotechnic tear gas inside, and he jumped out a window and was captured, Lt. Richard Lawhead said. The suspect was identified as Terry McKinny, 59, of San Bernardino.

RELATED: Man in standoff had previously acted erratically

Police received a report of shots being fired about 3 p.m. Sunday in the 700 block of West 19th Street, between G and H streets, Lawhead said.

Officers on scene during the standoff said the gunman fired at a group of about 10 children as they approached an ice cream truck, whose driver fled when the truck was struck three times. Lawhead said another car also was hit.

No one was injured by the gunfire.

McKinny then retreated into a house and barricaded himself inside. Police attempted to communicate with McKinny, but he was uncooperative, Lawhead said.

Police evacuated about 25-30 homes in the neighborhood and kept traffic out of a perimeter of several blocks.

McKinny was “ranting,” but refused to communicate directly with police, Lawhead said.

At one point during the standoff, McKinny came outside and dropped a bag — which police say might have contained a rifle — inside the gate of a fence that surrounds the property.

About 8 p.m., a police officer inside an armored vehicle known as a Bearcat tried to deliver a phone to the house in an effort to make contact.

“The suspect fired multiple rounds at officers, striking the vehicle,” Lawhead said.

After the standoff was over, San Bernardino Police Chief Jarrod Burguan tweeted a photo of the Bearcat where it was struck by the bullets, with the message: “Tonights armed suspect took a few shots at our Bearcat (armored). The veh did it’s job and protected our officers.”

Shortly after McKinney shot at the Bearcat, police began firing tear gas inside the house. They deployed about 20 rounds, Lawhead said, but still McKinny didn’t come out.

The San Bernardino County Sheriff’s Department arrived with another armored vehicle that was capable of deploying pyrotechnic tear gas.

The gas caused a small fire to begin burning in the house. McKinny jumped out the window and was taken into custody.

Lawhead said McKinny was injured, but he didn’t know the extent of his injuries beyond a dog bite suffered when he was captured.

Police said the department has had issues with McKinny before.

Jose Villa, 36, and girlfriend Cynthia Miranda live two doors down, said the man has been a problematic neighbor, including arguing with other residents and acting erratically. They said were glad police were responding Sunday.

Staff writer Nikie Johnson contributed to this report.