German prosecutors say they have charged a former Iraqi soldier with war crimes on allegations he posed for a photo holding the severed heads of two Islamic State fighters killed in combat.

Federal prosecutors said in a statement Monday the incident occurred when 27-year-old Rami K., whose last name wasn't given in accordance with German privacy laws, was serving in the Iraqi military during 2015.

Prosecutors say after fighting north of Baghdad, "the suspect raised the severed heads of two IS fighters, who had been killed in combat, by the hair into the air" and had a photo taken, which he posted on a social network.

The suspect, who came to Germany as an asylum-seeker at the end of 2015, faces a minimum one year in prison if convicted.