The hunt for the terror network behind the Manchester attack is now focusing on Libya, where bomber Salman Abedi’s father and brother were arrested Thursday and from which Abedi himself had only recently returned.

That’s hardly surprising: South Manchester is home to one of the world’s largest Libyan expatriate communities, which in recent years has become a prime recruiting ground for young jihadists.

And Libya itself is the base for an ISIS external-operations wing tasked with plotting terrorist attacks in Europe. Indeed, since the fall of Moammar Khadafy, Libya has become a haven for Islamist terrorist groups.

Such is the result of Barack Obama’s failed policy — which he so confidently announced would prove smarter than his predecessor’s mistakes in Iraq, only to be proved horribly wrong.

Obama (with a huge push from then-Secretary of State Hillary Clinton) effectively brought about regime change in Libya, while avoiding the kind of occupation that proved so deadly and costly to the Bush administration after it ousted Saddam Hussein.

Yet all that did was create a huge vacuum, rapidly filled by civil war among various militias as well as ISIS and other extremists.

Libya’s anarchy is also responsible for a good part of the refugee flows that threaten to overwhelm Europe.

And it’s not as if no one saw it coming. On the contrary, the State Department’s top Middle East hand warned from the start that Libya’s post-Khadafy leadership was hopeless, leaving the country prey to becoming the failed state it now is.

In short, Obama and George W. Bush made the same mistake: They had no real plan for what came next after a despot’s ouster.

Bush eventually stabilized Iraq, though it turned south again after Obama withdrew the last few thousand US troops. Obama, by contrast, essentially gave up on Libya after an al Qaeda offshoot stormed the US consulate in Benghazi in 2012, killing the US ambassador and three others.

Now, as Benny Avni notes, Libya is where ISIS’ leaders will likely flee once they’re driven out of Iraq and Syria.