* Military incursion gives Erdogan boost in polls
* Opposition parties worked together in local elections
* Pro-Kurdish HDP alone in opposing Syria mission
* Dilemma for secularist CHP that conditionally backed mission
* AKP source says relations with Iyi Party warming
ISTANBUL/ANKARA, (Reuters) - Turkey's military incursion in Syria has given President Tayyip Erdogan a bump in opinion polls and exposed potential cracks in an informal political alliance that claimed surprise victories over his ruling party in local elections this year.
The operation in northeast Syria came after months of stagnant approval ratings for Erdogan, who had appeared vulnerable after his AK Party (AKP) lost control of Turkey's two biggest cities for the first time since he took power in 2003.
Opposition lawmakers told Reuters they suspected Ankara's decision to launch cross-border attacks on the Syrian Kurdish YPG militia was taken largely to revive Erdogan's political fortunes at home. The government denies any such motive.
Erdogan's popularity had come under pressure after last year's currency crisis caused a recession that sent unemployment soaring, and also from criticism by former prominent AKP members who are expected soon to launch new parties.
But some three quarters of Turks support the Syrian incursion, launched on Oct. 9, polls show, despite international condemnation, including by Ankara's NATO allies.
Erdogan's own approval rating rose last month to 48%, a Metropoll survey showed, its highest since shortly before the height of the currency crisis last year. His disapproval rating was at its lowest since a coup attempt in 2016.
Ankara says the YPG is a terrorist group with links to Kurdish militants at home. It has struck deals with Moscow and Washington to push back from the border region YPG fighters, who for years were U.S. allies in the fight against Islamic State in Syria.
The incursion put the main opposition Republican People's Party (CHP) in a bind: its conditional support for the action put it at odds with the pro-Kurdish Peoples' Democratic Party (HDP) that helped it win the Istanbul and Ankara mayoralties.
The leftist HDP, mainly backed by Kurds who make up some 18% of the population, is the only major party opposing the mission.
Earlier this year the HDP offered outside support to an alliance of the secularist CHP and the nationalist Iyi Party, who oppose what they see as Erdogan's authoritarianism and handed him stinging losses in March and June local elections.
Any splintering between these parties would be a further boon for Erdogan, though one CHP lawmaker said he expected their cooperation to continue.
"It is clear that the aim (of Erdogan)... is to demolish this democracy alliance that the CHP has formed... and to weaken the relationship that it has formed with Kurdish voters," said Sezgin Tanrikulu, who opposes the Syria operation.
"It has created a disenchantment but in my opinion this is not irreparable. The period ahead of us will be a period in which... the relationship of trust will be established again."
Commenting on Erdogan's improved ratings, Lutfu Turkkan, deputy group chairman of the Iyi Party, said polling firms were confusing support for the troops with support for the president.
"The soldiers have succeeded but the politicians and diplomats have yet to achieve something (in Syria)," he said.
But Turkkan also dismissed the HDP's criticism of the incursion. "The HDP's rhetoric on this has no meaning for us" because removing terrorists from Turkey's borders is a matter of national survival, he said.
The CHP and Iyi Party have 139 and 39 seats respectively in Turkey's 600-seat parliament. They both backed a mandate extending military operations in Syria and Iraq while the HDP, with 62 seats, opposed it as a violation of international law.
The opposition cannot afford to splinter if it hopes to challenge Erdogan on a national level given roughly half of Turks have strongly backed him for years.
A source close to Erdogan's AKP said "it will be extremely important who sides with whom" in the next election, adding "there is a warming" between the Iyi Party and the AKP.
Iyi Party chairwoman Meral Aksener has previously denied the two parties were getting closer.
The incursion has deepened a sense of alienation among Turkey's Kurds, especially after Ankara ousted some HDP mayors and arrested dozens of people in the country's southeast.
Underlining the CHP's dilemma, a poll shared among its members and seen by Reuters showed some 46% of its voters either disapproved of the Syria operation or were undecided. The CHP backed the mission even while it carved out policy differences from the AKP including calling for dialogue with Damascus.
"This support (from the CHP) was a lifeline for the AKP. That was what they wanted and they got it," said HDP lawmaker Meral Danis Bestas, adding that her party would now have to decide on its future cooperation with other parties.
Turkey's military conducted two other operations in northern Syria over the last three years. Shortly after each, Turks were sent to the polls for a referendum in 2017 and for nationwide elections in 2018.
"This pattern suggests this was the main motivation for the mission," said Unal Cevikoz, the CHP's deputy chairman.