A Texas man opened fire Thursday morning when he spotted what he believed to be a burglar near his neighbor’s truck.

That prowler, however, turned out to be an undercover police officer attempting to place a tracking device on a suspect’s car as part of a federal drug investigation, reported WFAA-TV.

The officer was hospitalized with gunshot wounds to his arm, leg and hand, but the Arlington police chief said he was expected to recover.

ADVERTISEMENT

The neighbor may not face any charges in connection with the shooting, which led to an hours-long standoff in a residential neighborhood.

“Texas law also allows for use to use deadly force to stop a burglary,” said Toby Shook, a former prosecutor. “Texas law is pretty liberal in this area.”

The undercover officer was placing the GPS device on the pickup about 6 a.m. when the neighbor, whose name has not been released, asked him what he was doing.

The officer told the man he had dropped something, and sources said the man opened fire with what they described as an assault rifle.

Another neighbor who witnessed the shooting said the wounded officer was dressed all in black and never identified himself as a police officer.

ADVERTISEMENT

The witness said a pickup quickly drove up to pick up the wounded officer and then did a U-turn and sped away.

Police said the neighbor continued firing his rifle at the fleeing pickup truck, and the undercover officers drove to a nearby gas station and called for help.

Investigators said the Ford F-150 was shot 12 times in the tailgate and four times along the side.

ADVERTISEMENT

A man and woman were taken into police custody about 8 a.m. at the shooting scene, but police have not described their connection to the case.

A SWAT team remained at the house until about 2:30 p.m., when they left and turned over surveillance to patrol officers.

ADVERTISEMENT

The case remains under investigation.

Watch the entire report posted online by WFAA-TV: