Two men who posed for pictures dressed in imperial Japanese military uniforms in front of a Nanjing memorial site were detained for 15 days, local police said.

The photos show that the two men held a rifle and a saber while wearing caps and uniforms of the Imperial Japanese Army during the War of Resistance Against Japanese Aggression (1931-45).

The photos were taken in front of the Shaojiashan bunkers at Zijin Mountain, where many Chinese lost their lives fighting Japanese soldiers during a four-day battle in December 1937.

The photos began circulating on Tuesday on Sina Weibo.

Jiangsu police captured the two men on Thursday night. One man, surnamed Zong, 22, was caught in Jurong, Jiangsu province. The other, surnamed Tang, 25, was found in Dazhou, Sichuan province.

The two men admitted taking the photos and showed regret, Jiangsu police said.

The men were well aware that the Shaojiashan bunkers were a memorial site used to repel Japanese soldiers and planned to choose such a place to pose for pictures, Jiangsu police said.

Police also said that nobody can challenge the dignity of the country, and that any behavior cannot break the laws, either in public or online.

In April 2015, one of the detained, surnamed Tang, also wore imperial Japanese military uniforms to attend a cosplay convention in Chengdu and caused a scene. He argued that what he wore was not an imperial Japanese military uniform but a cosplay costume, Nanjing newspaper Modern Express reported.

"What they did defiled the dignity of those who died for their country," said Tang Kai, an expert on the history of the War of Resistance.

"Almost 100,000 Chinese soldiers died in Nanjing fighting the invading Japanese army. The two men showed no respect to Chinese society."