A gunman opened fire in the US state of Maryland, killing at least three people.

Another person was critically injured in the incident on the site of a machine factory in the northern town of Smithsburg, the local sheriff's office said on Thursday (local time) via Facebook.

Accordingly, the alleged perpetrator fled after the shots.

When the police caught him a little later, there was an exchange of fire, in which the suspect and a police officer were injured.

Both are under medical treatment, it said.

The background to the crime initially remained unclear.

Maryland Governor Larry Hogan confirmed at a press conference that three people were killed.

Before the arrest, the suspect shot a state police officer in the shoulder, after which the officer fired back.

Hogan initially had no details on the suspect's medical condition.

Two weeks ago, a massacre broke out in the small Texas town of Uvalde when an 18-year-old shot 19 children and two teachers with an assault rifle in an elementary school.

In the light of the continuing gun violence in the USA, the Democrats are currently trying to tighten legislation and make access to guns more difficult.

However, they fail because of opposition from the Republicans.