A Fairfax County police officer has been cleared of wrongdoing after shooting and killing a Woodbridge man who had allegedly fired shots in the officer’s direction, police said Friday.

Fairfax County Commonwealth’s Attorney Ray Morrogh concluded Officer Edward Carpenter was justified in shooting 21-year-old Nicholas Allen Kaelber, Fairfax County police said.

The incident began abut 11:20 p.m. on July 8, when Carpenter and another officer observed two men acting suspiciously in the area of Frye Road and Madge Lane in Mount Vernon, police said.

When officers approached, one of the men fled, police said. The officers chased him for a short distance and a struggle ensued, during which the man produced a gun and fired in the officers’ direction, police said.

Carpenter returned fire, striking Carpenter, police said. Kaelber was transported to a local hospital, where he died a short time later. Neither officer was injured

Carpenter is a seven-year veteran of the force and is assigned to the Mount Vernon station.