Hammam al-Alil, Iraq - Ask anyone in the northern Iraqi town of Hammam al-Alil where Mustafa Taei lives and they will direct visitors down increasingly narrow streets through the bazaar towards a vibrantly painted breeze-block house.

Outside, a mural depicts painted palm trees and Iraqi flags fluttering over a mosque and a church. Standing alongside are a winged Assyrian deity, the Ziggurat of Ur and the ancient Babylonian Ishtar Gate. They are symbols of Iraq's cultural heritage and historic plurality. Taei, a resident of Hammam al-Alil, says he was briefly jailed by fighters with the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) who controlled the town until last November.

"Daesh beat me with sticks when they heard I was painting," Taei says, beaming widely through broken glasses perched precariously on his nose. He has reason to smile: He is now free to paint openly again.

A town about 20km south of Mosul on the western bank of the Tigris River, Hammam al-Alil was once notable mainly for the spa baths from which the town derives its name. Taei grew up here, working most of his life as a gas engineer and later as a jack of all trades.

Some people smoke but I paint. It's in my blood. Mustafa Taei, Iraqi artist

"He can do everything," says Hamid Yassin Ahmed, a cousin of Taei. "People come to him to get their cookers, or generator, or even their car fixed. But he's most famous for his paintings."

For the last 20 years, Taei's passion has been art. "I can't imagine a day without this," says the 53-year-old of the drawings, woodcuts and Arabic calligraphy that cover the walls of his home.

In mid-2014, though, Taei was forced to hide his art. That summer, ISIL fighters tore across the desert from Syria to capture much of Nineveh, including the provincial capital Mosul. ISIL imposed a strict regime that banned everything from mobile phones to smoking.

Also banned were any pictorial depictions of the human form.

Taei stashed his artworks but continued to paint in secret, describing it as an addiction. "Some people smoke but I paint," he says. "It's in my blood."

The other townspeople of Hammam al-Alil did not cooperate willingly with ISIL either. Under ISIL rule, draconian punishments were imposed, including numerous public executions and floggings.

Taei's work took a subversive turn, becoming a gruesome record of atrocities: decapitations, hangings, injured children and sobbing widows, all painted in an unschooled Naive art style.

Taei was detained for two weeks and tortured, and was lucky to escape execution.

Last October, after Prime Minister Haider al-Abadi announced the start of the military operation to retake Nineveh province, some of the townspeople of Hammam al-Alil staged an uprising that was crushed by ISIL.

A month later, in one mass grave just outside the town, the Iraqi military uncovered about 100 decapitated bodies.

Taei has since depicted many of their deaths in his paintings. "This is martyr Hany; he was killed shortly before the liberation," says Taei, showing a painting of a dead body.

"He was naked when they killed him, but I painted him in his uniform because I respected him and wanted to give him back his dignity."

READ MORE: Syrian refugee children transform Iraqi prison with art

Some of these grislier paintings make the townspeople uncomfortable. He recently staged an exhibition in a school in the town, and confesses to being slightly disappointed with a lack of recognition.

"No one said anything much about them or asked me any questions," he says.

While his painted record of Hammam al-Alil offers a grim testament to what life was like under ISIL, Taei has recently applied his skills to painting "martyr posters" that pay tribute to the growing number of soldiers and police who have died in the ongoing military operation to liberate Nineveh.

Taei says he's struggling to keep up with demand.

As he rifles through stacks of paintings, two blue-uniformed federal policemen knock at the door. They have come straight from duty, hand grenades still dangling from their belts.

Amin Saad, a 31-year-old sergeant from Baghdad, carries photographs showing two young men in uniform, Ahmed Nagi and Assad Gerid, friends from his unit. "They were killed yesterday," Saad says.

He wants to honour their memory by commissioning Taei to paint a commemorative poster, he says. "We'll take this painting back to our base and hang it on the wall as a memorial."

Since Hammam al-Alil was retaken by the Iraqi army in November, Taei has become renowned among Iraqi forces for his posters. "He's famous here," says Saad. "He's done other posters for us before."

In all, Saad estimates that 40 members of his unit in the federal police have died fighting ISIL. For his part, Taei says he has painted over 100 memorial posters.

With the policemen waiting, Taei excuses himself to begin painting. He knows it is not the last such poster he will have to do before the fighting is over.