Turkey is a NATO partner that stands with U.S. troops on the battlefields of Syria and Iraq, but it's an ally that's increasingly turning its guns on fighters the U.S. sees as vital to crushing ISIS.
On Wednesday, Turkey launched one of its biggest airstrikes in decades — bombing 18 positions in northern Syria and killing an estimated 200 fighters.
But the strikes north of Aleppo didn't involve President Bashar al-Assad's army, or any of the main groups fighting his government like the Free Syrian Army, the Jihadi militia Jabhat Fatah al Sham, or even ISIS.
Instead, Turkey bombed People's Protection Units, or YPG — Kurdish militia the U.S. considers the most effective force against ISIS in Syria.
Turkey has sent 2,000 troops into Iraq, where they are watching the massive military operation aimed at recapturing Mosul from the extremists. Baghdad maintains Turkey has violated its sovereignty and on Thursday issued an arrest warrant for an ex-Mosul governor who allegedly "invited" in the troops.
These latest in a series of military moves reveal how the government of President Tayyip Erdogan is reasserting its historic territorial claims while also trying to crush the country's mortal enemies — Kurdish separatists.
Ankara has fought ethnic Kurdish militias within its borders for decades to prevent the birth of a new country, Kurdistan, carved out of Turkey itself. So it has watched carefully as YPG fighters secure large swaths of land along the Syrian-Turkish border.
To Turkey's government, these Kurds are no different to the outlawed PKK militants who have carried out a series of deadly bombings within Turkey in the last year. The group is trying to force Turkey to accept the Kurdish right to an independent state, which has been denied them for a century.
Perhaps more terrifying for Turkey, Kurdish groups have established a state in all but name in northern Iraq. Its capital Erbil is one of the only functioning, tolerant and relatively peaceful cities in the country.
The problem as Turkey sees it is that the Kurds want the same for northern Syria. And then they want to link the two, which is anathema to Ankara.
'The Mosul Question'
Something else is motivating Turkey apart from the Kurds, and this goes back 100 years.
The Kurds were among the great losers after World War I, having failed to gain an independent homeland as the conflict's winners scooped up the war spoils.
The Turks also emerged humiliated from the conflict, their once great Ottoman Empire shattered and shared out among the victorious French, who took control of Syria and Lebanon, and the British, who moved into Iraq and Palestine.
One issue and one city has remained contentious to this day.
What was dubbed "The Mosul Question" in the 1920s plagued the organization that was the precursor to the United Nations.
Turkey desperately wanted to keep control of a city it had controlled for centuries and considered vital to its image as a power. Mosul's people, it argued, were bound to Turkey by history, trade and tongue.
The Turks also coveted the region's oil wealth.
Turkey considered the entire swath of land from the Sinjar Mountains, where ISIS attacked the Yazidi people in this current war, through Iraq's Erbil and Kirkuk, all the way to the Iranian border, as its natural strategic buffer zone.
The Great Powers, led by Britain, would have none of it. The British saw Mosul as an Arab city built by Arabs. British diplomats and leaders also reasoned the Turks would threaten Baghdad if it they got their hands on Mosul again.
So Turkey lost when the League of Nations ruled against it in 1926. But its obsession with Mosul has not gone away.
So Turkey is eyeing the current war and the attack on ISIS-held Mosul carefully.
Chiefly, it's watching what the Kurds do, where they go, how strong they are, and how much backing they get from the U.S. and anyone else.
On Thursday, Kurdish peshmerga fighters opened a new front against ISIS north and east of Mosul, coming close to but avoiding the Turkish army's training base at Bashiqa.
The base has for weeks been the focus of a diplomatic spat between Iraq and Turkey.
"Know your place … you are not at my level!" Erdogan fumed to the Iraqi Prime Minister Haider al-Abadi on October 1. His anger came after Iraq's parliament labeled Turkey an "occupying force … (that risked) a regional war."
Turkey maintains it has no intention of pulling out of its base near Mosul. Once the city is taken from ISIS, Ankara is aiming to become the main protector of its Sunni Muslim population.
That's because the city's liberation from ISIS may come at a terrible price for its people. Human rights groups have already accused Iranian backed Shiite militias hovering near Mosul of committing atrocities against other Sunni populations.
So the Turks, helped by Saudi Arabia, will position themselves as Sunni saviors. And Mosul is close enough to the Iranian border for the Saudis to help the Turks counter another foe — Shiite Tehran.
Erdogan has his own motives for foreign war. He has frustratingly failed to remove Assad from power in neighboring Syria, and is still trying to shore up his own political power after crushing a failed coup in July.
War in Syria that focuses on crushing Kurds is a popular policy at home.
Miniature World War
In parallel to the Mosul front, Turkish tanks and jets are attacking Kurdish YPG units in Syria.
And Turkey is forging ahead with Operation Euphrates Shield, announced in August, its attempt to carve out a 2,000-square-mile buffer zone deep into Syrian territory.
Turkish intelligence and special forces are digging in as aid organizations and Turkish civic groups build houses for those who've fled their homes — all of them pulling together to establish a so-called safe zone along the border. Except it's much more than that.
Turks, Arabs and Persians are vying for control and influence in a region that's been their battleground for millennia.
Just as Turkey dreams of influence in Mosul, it is eyeing Syria's Aleppo — another ancient city with deep and powerful ties to Turkey, another city in the crosshairs of a dozen forces, its future up for grabs.
One thing is certain — Iraq and Syria will never again be the countries they were for a century, their neat border lines drawn by European diplomats in dinner jackets.
When ISIS destroyed the border between Syria and Iraq and declared the end of the British-French agreement that dismembered the Ottoman Empire, everything was up for grabs.
The Syrian war that began with street protests against the rule of the Assad family has come a long way. In the week alone, French, Russian, British, American, Australian, Turkish and Syrian jets have flown sorties over Syria.
A Russian aircraft carrier is heading for the coast off of Syria. Iranian and Lebanese militias are battling ISIS units who attract fighters from Yemen, Saudi Arabia, Chechnya, Pakistan and beyond.
It's a world war in miniature.
And Turkey is at the very heart of it, trying to unmake the WWII settlement that denied it the Mosul buffer and ignited 100 years of Kurdish grievance.