Turkey has for the first time allowed female members of the armed forces to wear headscarves while on duty as part of their uniform.

Women serving in the armed forces "will be able to cover their heads" under their caps or berets so long as the headscarf is "the same colour as the uniform and without pattern", said a new defence ministry regulation announced on Wednesday.

The lift on the ban is going to come into effect once the regulation is announced in the Official Gazette, according to Turkish media.

READ MORE: Turkey allows policewomen to wear headscarves

The ruling Justice and Development Party (AKP) has long pressed for the removal of restrictions on women wearing the headscarf in the officially secular state.

Turkey lifted a ban on the wearing of headscarves on university campuses in 2010.

It allowed female students to wear the garment in state institutions from 2013 and in high school in 2014.

In August 2016, the AKP government lifted the ban on headscarves in the police force.

Turkish military has long been known as the "protector of secularism" in the country and worked against efforts to lift the headscarf ban in the public sector for decades.

Turkish authorities have launched an unprecedented shake-up of the country's security forces after a section of the army attempted to overthrow the government on July 15, and have sacked thousands of officers, footsoldiers and even generals who allegedly took part in the violent plot.