ANKARA, Turkey - Turkish lawmakers moved up elections to July 22 on Thursday, after the Islamic-rooted ruling party and its secular opposition agreed that an early ballot was the only way out of their standoff over political Islam.

The vote was unanimous despite objections from opposition legislators, who said the turnout would be low because many Turks would be on vacation. The ruling party has a majority in Parliament, and the opposition would not have been able to change the date.

"Let's not create more chaos, as we are trying to get out of the chaos," Haluk Koc, a legislator from the opposition Republican People's Party warned during the debate earlier in the day.

Prime Minister Recep Tayyip Erdogan called for early elections after opposition lawmakers boycotted a parliamentary vote on Foreign Minister Abdullah Gul's candidacy for presidency. The Constitutional Court invalidated the ballot because a quorum was not present.

At the heart of the conflict was a fear that Erdogan's Justice and Development Party would use control of both Parliament and the presidency to chip away at the separation of state and religion, and curb secular freedoms such as women's rights.

The standoff has drawn hundreds of thousands of pro-secular protesters into the streets.

Although most Turks are Muslim, secularism is enshrined in the Constitution and fiercely protected by the military, which warned last week against the growing profile of Islam and reaffirmed its willingness to act as the "absolute defender of secularism."

The United States and European Union on Wednesday warned Turkey, a NATO member and close ally, to prevent its military from defying civilian leaders. The military has seized power from civilian governments three times in past decades.