A U.S. soldier who took his ex-girlfriend hostage in a south German town was fatally shot in a confrontation with police, a police spokesman said Friday.

The 30-year-old soldier, whose name and unit information were not released, tied up his ex-girlfriend in her apartment in the southern town of Koenigsberg and threatened her with violence, police spokesman Karl-Heinz Schmitt said.

She managed to escape and alert police, who then started hunting for the soldier, using a helicopter with a thermal camera.

At about 11 p.m. Thursday, police commandos found and confronted the soldier, who threatened them with an M4 rifle, Schmitt said.

Police fired, critically injuring the soldier. He was taken to a Schweinfurt hospital where emergency surgery was performed, but he died about an hour later, Schmitt said.

It was not immediately clear whether the soldier fired at police, Schmitt said. The incident, including how the soldier, who was stationed in Schweinfurt, managed to leave the base with the rifle, is under investigation.

U.S. Army Europe spokesman Bruce Anderson said that military authorities were in touch with German officials about the incident and are investigating it, but that no further details were immediately available.

The U.S. military has been shuttering many facilities in Germany in recent years. However, there is still a large presence in Bavaria, and several units are based in Schweinfurt.