Turkey's new military chief, a quiet, hardline secularist, takes command on Friday of a force that sees itself cornered by EU-driven reforms and an emboldened government with roots in political Islam.

The change of command in NATO's second biggest army comes as the ruling AK Party takes on the judicial establishment, another bastion of the secularist opposition, in challenges analysts say will define the future of the Muslim democracy.

General Isik Kosaner, who was trained as a commando officer and worked in intelligence, will be tested among other things by trials of senior military officers charged with plotting to overthrow the government and a surge in a decades-long separatist conflict in the southeast.

His appointment as chief of staff this month came at the end of several days of tension in the Supreme Military Council, a body dominated by generals but chaired by the prime minister, in which the government blocked the promotion of some top officers.

He has a difficult job ahead of him, said analyst Wolfango Piccoli from the Eurasia consultancy group.

There is discontent in the ranks at government-military relations and PKK violence is on the rise, Piccoli said, referring to an increased campaign of violence by Kurdistan Workers Party (PKK) separatist guerrillas.

The military, self-appointed guardians of secularism, has toppled four governments but reforms carried out as part of a bid for membership of the European Union have curbed its power.

The Pashas have also been humbled by AK, which first swept to power in 2002 and is backed by a rising conservative middle-class that has challenged the old secularist elite.

Despite unprecedented setbacks that have discredited the soldiers' image, experts expect ties between Prime Minister Tayyip Erdogan's government and the military to be smooth, although not without moments of tension.

Kosaner's predecessor, General Ilker Basbug, has said repeatedly that the days of coups are over.

I don't think there will be a conflict with the government. He's a democrat and he will try to protect the armed forces through democratic ways, Necati Ozgen, a retired general, said of Kosaner.

He takes the top job after being promoted from land forces commander. Known as an old-school secularist, he has shied away from public statements in the past, preferring a quiet approach.

Kosaner is expected to formally take command at a ceremony in the general staff headquarters in Ankara at 5:30 p.m. (3:30 p.m. British time) which will be attended by Erdogan and President Abdullah Gul.

REFERENDUM

Turks will vote in a referendum on September 12 on constitutional reforms proposed by the government.

If approved, the changes would further assert civilian control over the military, including limiting the jurisdiction of military courts and calling for military officers accused of coup-plotting to be dealt with exclusively by civil courts.

Other contentious elements of the package are articles related to the appointment of senior judges and prosecutors.

Erdogan's AK, which evolved from an Islamist party though it eschews that label, says the reforms are needed to end Turkey's military tutelage.

Observers will also be watching out for any grumbling in the barracks under Kosaner over the Sledgehammer case, in which prosecutors say officers discussed a plan to destabilise the government during a war-game seminar seven years ago.

Last month, warrants were issued for the arrest of 102 retired and serving officers, including a former commander of the First Army, though those warrants were later dropped.

The case, which critics say is part of a government campaign to undermine the military, is due to go to trial in December.

Observers say the military is aware that its loss of influence is inevitable, but say the government must be careful not be perceived as acting out of revenge.

Every country needs a military, a European diplomat said.

The government and the military need to find a normal, democratic relationship like in the rest of Europe.

(Editing by Jon Hemming and Noah Barkin)