Turkey launched an all-out military offensive against Kurdish fighters in northern Syria on Wednesday, just days after President Trump announced US troops would be pulled from the area.

Airstrikes and artillery pounded the region, softening defenses for a ground offensive as long-building tensions culminated in a dramatic first day of what Turkish President Recep Tayyip Erdogan called a push against terrorists.

“Our aim is to destroy the terror corridor which is trying to be established on our southern border and to bring peace . . . to the region,” he wrote on Twitter of what he’s dubbed “Operation Peace Spring.”

Turkey “will preserve Syria’s territorial integrity and liberate local communities from terrorists,” he added.

Although Trump’s administration agreed to remove US troops, which had been working as allies with local Kurds to fight ISIS, he said in a statement Wednesday that the White House “made it clear to Turkey that this operation is a bad idea.”

Turkey “has committed to protecting civilians, protecting religious minorities, including Christians, and ensuring no humanitarian crisis takes place,” Trump said. “And we will hold them to this commitment.”

Trump also defended his decision to withdraw troops as being in America’s best interest.

“The United States has spent EIGHT TRILLION DOLLARS fighting and policing in the Middle East,” he wrote. “Now we are slowly & carefully bringing our great soldiers & military home. Our focus is on the BIG PICTURE!”

Turkey views the Kurdish People’s Protection Units — also known as the YPG — in Syria as terrorists because of their ties to militants waging an insurgency inside Turkey.

Heavy shelling pounded border towns, sending plumes of black smoke billowing skyward, as civilians grabbed what possessions they could carry and fled for safer ground.

Turkish jets pulverized suspected hiding spots of Syrian Kurdish forces in the town of Ras al-Ayn, creating booming explosions that could be heard across the border in Turkey.

A US official speaking on condition of anonymity said the airstrikes were not coordinated with the US military.

Also struck was Tal Abyad, where bombs hit an office of the Syrian Democratic Forces — an overarching coalition that includes the YPG — sending nearby residents running for their lives.

“People fled and left everything behind,” a local named Maher told The Associated Press, recounting his frantic flight to Raqqa with his wife and mother along a 60-mile road thick with retreating civilians.

At least seven civilians and one member of Kurdish-led forces were killed in the first day of fighting, according to Kurdish activists and a Syrian war monitor.

Turkey had been poised to advance into Syria since US forces began vacating the area following Trump’s abrupt policy shift, which has been assailed in Washington — including by Republicans — as a betrayal of the US-allied Kurdish fighters who helped combat ISIS.

“Pray for our Kurdish allies who have been shamelessly abandoned by the Trump Administration,” bemoaned Sen. Lindsey Graham, typically a reliable Trump backer.

“This move ensures the reemergence of ISIS.”

Despite the reservations of Graham and others on both sides of the aisle, Trump insisted in his comments Wednesday that he wants to end “forever wars” claiming American lives.

He also said that the Kurds, while traditional allies of the Americans, haven’t always been there.

“They didn’t help us in the Second World War, they didn’t help us with Normandy,” said Trump, adding that they only fight for “their land.”

“With all of that being said, we like the Kurds,” he added.

The United Nations Security Council is set to meet behind closed doors on Thursday to discuss the conflict.

The sit-down was requested by the five European members of the 15-member council — Britain, France, Germany, Belgium and Poland, diplomats said.

With Post wires