A four-year-old girl was shot and wounded last week in Fauquier County, Va., when a 2-year-old boy fired a gun by accident, the county sheriff’s office said.

The boy and the girl were among three children and two adults in a vehicle that had stopped in Opal, Va. Friday night, the sheriff’s office said.

The children were left unsupervised while the vehicle was stopped at a business, the sheriff’s office said. In a statement, the sheriff’s office said the boy “gained access to an unsecured firearm and accidentally discharged it.” The sheriff’s office said the girl was hit in the upper body.

The child was later treated at a trauma center and released, the statement said.

The sheriff’’s office said Isaiah Marshall Davis, 26, of Winchester, Va. was charged with allowing access to a firearm by children.

Virginia law makes it a misdemeanor to “recklessly leave a loaded, unsecured firearm in such a manner as to endanger the life or limb of any child under the age of fourteen.”

Opal, the site of the incident, is a little more than 50 miles southwest of Washington. The relationships among the people in the car were not specified.