A U.S. soldier has been banned from Denmark for 12 years after he was convicted last week of attempted rape in the country.

The soldier was assigned to a special operations unit in Europe when the incident occurred, according to Stars and Stripes.

The 21-year-old was also sentenced to 18 months in prison.

Stars and Stripes reported that the soldier, who the newspaper said Army officials refused to name, was serving in a support role with Special Operations Command-Europe but was not a Green Beret.

On June 3, a 19-year-old woman was returning home when a man followed her and pulled her into some containers, the region's police department said on Twitter. Police said the man ripped her underwear down, but the woman fought back and kicked her way free.

According to police, the woman described the man as "Danish of appearance" but spoke English with a clear American accent.

The next day, a U.S. soldier was taken into custody and kept in pretrial detention, pleading not guilty, Stars and Stripes said.

× Fear of missing out? Sign up for the Army Times Daily News Roundup to receive the top Army stories every afternoon. Thanks for signing up. By giving us your email, you are opting in to the Army Times Daily News Roundup.

The soldier was assigned to Stuttgart, Germany, but was in Denmark for training.