An irate President Trump on Tuesday defied mounting bipartisan pressure to end his zero-tolerance policy of taking migrant children away from their parents — and charged that Democrats want “illegal immigrants” to “infest” the US.

“Democrats are the problem. They don’t care about crime and want illegal immigrants, no matter how bad they may be, to pour into and infest our Country, like MS-13. They can’t win on their terrible policies, so they view them as potential voters!” the commander-in-chief raged on Twitter.

And he defended his policy, saying that “only 2,000” children have been taken away from their parents.

“We must always arrest people coming into our Country illegally. Of the 12,000 children, 10,000 are being sent by their parents on a very dangerous trip, and only 2000 are with their parents, many of whom have tried to enter our Country illegally on numerous occasions,” the president tweeted.

“If you don’t have Borders, you don’t have a Country!” he added in another tweet.

“#CHANGETHELAWS Now is the best opportunity ever for Congress to change the ridiculous and obsolete laws on immigration. Get it done, always keeping in mind that we must have strong border security,” he said in a fourth.

The president in another tweet also doubled down on his false claim that crime is up in Germany as a result of the country’s immigration policies — suggesting he had inside information that Germany’s leaders have kept a lid on.

“Crime in Germany is up 10% plus (officials do not want to report these crimes) since migrants were accepted. Others countries are even worse. Be smart America!” he wrote.

Crime in Germany is at its lowest level since 1992.

Trump planned to talk about immigration legislation later Tuesday with House GOP lawmakers at the Capitol.

And one of Trump’s top allies in Congress said he would introduce stand-alone legislation to stop the family separations — in case a pair of House Republicans’ broader immigration bills fail this week.

North Carolina GOP Rep. Mark Meadows, a leader of the conservative Freedom Caucus, says his bill “becomes a backup proposal.”

The legislation was expected to take an approach similar to the family separation provisions in the House Republican bills.

They loosen existing procedures that limit the amount of time minors can remain in custody, which would allow them to stay with their parents rather than face separation.

Critics complain it would open the door to longer detentions for kids.

The administration is under pressure to reverse an immigration enforcement policy that has led to the separation of nearly 2,000 migrant children from their families in recent weeks.

Democrats are united in their opposition, and a growing number of Republicans — including conservative Texas Sen. Ted Cruz — also are calling for an end to Trump’s hardline policy.

“All Americans are rightly horrified by the images we are seeing on the news, children in tears pulled away from their mothers and fathers. This must stop. Now,” Cruz said in a statement.

Republican Rep. Bob Goodlatte of Virginia said lawmakers “need to do everything we can” to make sure children can stay with parents who cross the border illegally.

Goodlatte is chairman of the House Judiciary Committee and a key player on immigration legislation before the House this week.

He said in an interview Tuesday on CNN that he has no objections to keeping migrant families together.

He added that he is backing the two House immigration bills that are set to come up for a vote.

Goodlatte authored one of the measures, which is favored by conservatives.

A rival, compromise GOP immigration measure includes language curbing the separation of immigrant children from parents when they are detained.

Lawmakers also hope to add that language to a more conservative measure.

If neither bill can pass, Goodlatte said he will take a look at a simpler, short-term bill sponsored by Cruz that would keep families together.

Homeland security officials say they are still working out the process of reunifying parents with their children after they’re separated at the border.

Officials said Tuesday that 2,342 minors were separated from their parents who were caught trying to come to the US illegally from May 5 to June 9.

Later, during a rambling speech at the National Federation of Independent Business’ 75th anniversary celebration at the Hyatt Regency, the president riffed on child smuggling, the need for his proposed border wall, immigration reforms, Canada and his election night victory in November 2016, among other topics.