If there’s one thing rookie congresswoman Alexandria Ocasio-Cortez knows about, it’s grandstanding.

She turned her visit to a detention facility for illegal immigrants at the border this week into a media extravaganza. But her well-timed tantrum and cries of racism were pure baloney. AOC’s wild assertions that inmates were drinking out of toilets were debunked almost as quickly as they were spread by her credulous press cheering section.

She and other Democrats are seeking to spin what is a very real crisis as evidence of the administration’s moral failings. But if they want someone to blame for the conditions they encountered, they can start by looking in the mirror.

The situation at the centers AOC visited is undoubtedly rough. When hundreds of thousands flood across the border, it’s hard to quickly provide services to handle the crisis. Yet this is not the fault of the Border Patrol or the Immigration and Customs Enforcement agency, let alone President Trump.

The problem is a massive surge of illegal immigrants pouring over the border that has overwhelmed understaffed and underfunded agencies that were already hard-pressed to cope with their responsibilities.

As El Salvador’s President Nayib Buekele said Monday, referring to the thousands of his citizens who are flooding north — including a father and daughter who drowned trying to cross the Rio Grande whose picture has become the symbol of this crisis — the responsibility for their plight belongs to failed Central American countries.

Part of the blame also belongs to politicians like AOC and her party’s presidential candidates, who want to decriminalize illegal immigration and give amnesty to those already here. Every mass movement across the border has been preceded by liberal promises that those who come here without following the rules don’t have to worry about being held accountable for breaking the law.

The only way to curtail this flood of migrants is to make it clear that all those who try will be caught and deported. Democratic pledges of free health care, college tuition and driver’s licenses are a neon welcome sign that led directly to the unfolding catastrophe at the border.

Nor does AOC, who voted against granting additional funding for the border facilities, have any standing to gripe about the fact that the lack of those funds has made things worse for the illegal immigrants who are caught or make bogus asylum claims. If it were up to her, conditions there would be even worse.

The tragic deaths at the border, as well as conditions at the detention centers, are not due to America’s moral failings or the result of Trump’s rhetoric. Trump didn’t create the mess in Central America. It’s those who have encouraged these people to endanger themselves and their children by coming here illegally who are the ones who should be apologizing.

Jonathan S. Tobin is editor in chief of JNS.org and a contributing writer for National Review. Follow him on Twitter: @jonathans_tobin