President Trump on Tuesday slammed Democrats who shared pictures of child migrants sleeping in cages to knock his immigration policies, only to backtrack after realizing the photos were taken during the Obama administration.

“Democrats mistakenly tweet 2014 pictures from Obama’s term showing children from the Border in steel cages,” Trump tweeted. “They thought it was recent pictures in order to make us look bad, but backfires.”

One photo of children in a cell was shared numerous times over the weekend amid outrage over Trump administration policies of separating illegal immigrant parents from their children at the southern border.

Trump opponents who shared the photo included activists, journalists and former Obama speechwriter Jon Favreau, who said: “This is happening right now, and the only debate that matters is how we force our government to get these kids back to their families as fast as humanly possible.”

However, that photo and other related images were published by The Arizona Republic in 2014, deep into Obama’s second term. Favreau later deleted the tweet, as did others who had used the pictures to blast the Trump administration.

On Tuesday, Trump adviser Kellyanne Conway told "Fox & Friends" that the backtrack suggests those critics were only interested in the photos as a partisan weapon.



"They didn't really care about the story about the migrant children," she said.

The photos were circulated amid a debate over the Justice Department’s zero-tolerance policy when it comes to arresting illegal immigrants. That policy refers all illegal border crossings for prosecution. Since children cannot be held in adult detention centers, they are often separated.

The Justice Department says the goal is to deter potential illegal immigrants from trying to cross the border, though critics say it is inhumane.

“If you cross the border unlawfully, then we will prosecute you. It’s that simple,” Attorney General Jeff Sessions said this month. “If you are smuggling a child, then we will prosecute you. And that child may be separated from you, as required by law.”

FORMER OBAMA OFFICIAL, LIBERAL ACTIVISTS SHARE 2014 PHOTOS FROM DETENTION FACILITY AS SWIPE AT TRUMP

On Tuesday, Trump also called for a “bipartisan bill” that would include funding for the wall at the southern border and “new Border Protection for good of country.”

It echoes a tweet Trump sent on Saturday where he called for Democrats to “end the horrible law that separated children from [their] parents once they cross the Border into the U.S.” and included demands for stricter immigration laws.

Fox News' Lukas Mikelionis contributed to this report.