A teenager with a replica gun was fatally shot Tuesday in a confrontation with a Maryland state trooper, the state police said.

The youth, identified by police as Peyton Ham, 16, was shot in the Leonardtown area of St. Mary’s County. Police said he lived near where the incident occurred on Hollywood Road.

Police said the teenager confronted a trooper with what turned out to be an Airsoft gun. Airsoft guns shoot nonmetallic pellets. Police said it resembled “an actual handgun.”

State police said the trooper was sent to the scene after two calls reported a male who was acting suspiciously and who appeared to have a gun.

There was no indication in the calls to police that Ham’s gun was not a real weapon, police said.

Police said a witness told them that Ham took a “shooting stance” and was pointing his gun at the trooper before the trooper fired. The trooper and Ham are both White, police said.

After being wounded, Ham pulled out a knife and tried to get up, another witness said, according to the police. The trooper ordered Ham to drop the knife before firing again, the witness told police.

Ham died at a hospital. The Airsoft gun and a knife were recovered.

The incident will be investigated by police, and findings will be reviewed by the county state’s attorney’s office.

Police said they did not know why Ham acted as he did. It would be part of the investigation, they said.