A man was shot and seriously wounded Sunday in Charles County by an assailant who was an acquaintance of the victim’s girlfriend, the county sheriff’s office said.

They said a suspect was arrested after a chase in which he tried to escape in a car, was stopped and broke free from officers. He fled on foot, but was subdued by a stun gun, which administers an electric shock, the sheriff’s office said.

Authorities said the shooting victim, who is 28, was hit about 1:30 p.m. on the back porch of a friend’s house in the 7400 block of Leonardtow Road in Hughesville. Someone he did not know pulled up and fired, the sheriff’s office said.

Shane Ryan Barnett, 28, of Hughesville was charged with attempted murder, first-degree assault and use of a firearm in commission of a felony, according to t he sheriff’s office.