An Indonesian kindergarten has apologised after images of children marching in niqab veils and carrying cardboard cutouts of assault rifles sparked outrage.

Organisers faced a torrent of criticism that the Islamic State-style outfits promoted jihadist violence in a country that has long struggled with militant attacks.

The group of about 15 students were taking part in a parade for Indonesia's independence day Friday near the country's second-biggest city Surabaya.

The Kartika kindergarten, which is located inside a military complex in Probolinggo town, said the costumes were resurrected from storage to save parents the cost of buying new ones.

It denied that the gun replicas and full-body veils promoted extremism.

"I never meant to teach violence to my students," said school principal Suhartatik, who like many Indonesians goes by one name.

"We only used the props that we already had to cut costs for parents. I deeply apologise."

On Independence Day yesterday, a video of a schoolboy climbing a flagpole in west Timor went viral on Indonesian social media. Today another video went viral: kindergarteners in black niqab carrying guns joined Independence Day carnival in Probolinggo, East Java #17an #RI73 pic.twitter.com/yN9tdyZwz5 — Yenni Kwok (@yennikwok) August 18, 2018

The costumes had been used in previous parades to teach students about the prophet Muhammad's faith and beliefs, she added.

But the principal's explanation was met with derision on Indonesian social media.

"Nobody carried assault rifles in the prophet's time - is this teacher that clueless about history or was she just trying to dodge the blame?" one user posted on Twitter.

Another tweeted: "Obviously the seeds of ISIS are being nurtured early on."

Indonesian parliamentary speaker Bambang Soesatyo also lashed out at what he dubbed a "very concerning case".

READ MORE Amnesty condemns Indonesia police killings

"Parents and teachers should protect children from damaging their way of thinking," he told news site Detik.

Parade organisers said they were embarrassed for failing to notice the provocative outfits.

"I really apologise - I did not check beforehand," said chief organiser Supini.

"This was supposed to be a cultural parade."

The incident came as Indonesia looks to promote itself as host of the 18th Asian Games, the world's biggest multi-sport tournament after the Olympics.

READ MORE IS-linked group disbanded in Indonesia

Indonesia has endured a spate of deadly militant violence in recent years.

The 17,000 island archipelago, which has the world's biggest Muslim population, suffered its worst attack in a decade in May after IS-inspired suicide bombers attacked several churches.

Indonesia's deadliest terror attack was the 2002 Bali bombing which killed more than 200 people.