Then-Sen. Barack Obama (D-Ill.) announces to a crowd gathered on the lawn of the old State Capital Building in Springield, Ill., in February 2007, that he is running for president. (Mark Wilson/Getty Images)

In a bid to bolster support for his hard-line immigration policies, President Trump has turned to an unlikely source: former president Barack Obama. In a Tuesday night tweet, Trump attached a video clip from 2005 of Obama, then a Democratic senator from Illinois, talking up the need to tighten border security.

“I agree with President Obama 100%!” Trump wrote.

The video shows Obama at a news conference, saying: “We simply cannot allow people to pour into the United States undetected, undocumented, unchecked and circumventing the line of people who are waiting patiently, diligently and lawfully to become immigrants into this country.”

Trump boosters seized on the comments overnight, as cable news continued to show footage of a migrant caravan making its way to the U.S.-Mexico border — a procession that has become a source of outrage for the president.

During a “Fox & Friends” interview Wednesday morning, White House counselor Kellyanne Conway called the Obama clip “delicious” and suggested a new litmus test less than two weeks before the Nov. 6 midterm elections.

“I think every candidate should be asked, ‘Do you agree or disagree with President Obama from 2005?’” she said.

It turns out Obama had a lot more to say than what Trump shared, and it’s doubtful that Trump agrees with 100 percent of it.

The 31-second clip was taken from a 27-minute news conference broadcast on C-SPAN in which Obama and Sen. Mel Martinez (R-Fla.) voiced support for comprehensive immigration reform legislation that the Senate would take up the following year.

Obama said his aim was “to bring the immigration debate toward the sensible center” through “pragmatic, comprehensive reform.”

He did, in fact, deride those “who enter the country illegally,” saying they are “showing disregard for those who are following the law.”

But Obama then pivoted to make two other points.

“Having said that, securing the borders alone does not solve immigration management,” he said. “We’re going to have to better manage legal immigration in order to end illegal immigration. . . . Right now we’ve got millions of illegal immigrants who live and work here without knowing their identity or background. That’s part of the reason we need a guest worker program to replace the flood of illegals with a regulated stream of legals who enter the United States after checks and with access to labor rights.”

Obama then turned to “a third principle,” which he said “is most important.”

“If we hope to bring the 11 million existing undocumented workers out of the shadows into the open, we have to give them a reason,” Obama said. “I am sympathetic, and I understand people’s frustrations with respect to those who have come here illegally, but we have to understand that they are now here, they are paying taxes, they are raising families, many of their children are U.S. citizens who were born here and are going to school here, and if we are going to get some handle on that population, then we’ve got to give them some incentive in order to come out into the open.”

“This means that we’re going to have to grant them some sort of interim legal status to work with the opportunity to eventually earn citizenship,” Obama said.

In a 2006 speech on the Senate floor, Obama sounded even less like Trump, asserting that “while security might start at our borders, it doesn’t end there.”

He continued: “In fact, I will not support any bill that does not provide this earned path to citizenship for the undocumented population — not just for humanitarian reasons; not just because these people, having broken the law, did so for the best of motives, to try and provide a better life for their children and their grandchildren; but also because this is the only practical way we can get a handle on the population that is within our borders right now.”

By Wednesday morning, Trump had returned to Twitter and the subject of immigration.

In one tweet, he pointed to immigration challenges in Europe.

“For those who want and advocate for illegal immigration, just take a good look at what has happened to Europe over the last 5 years,” the president wrote. “A total mess! They only wish they had that decision to make over again.”

In another tweet, Trump wrote: “We are a great Sovereign Nation. We have Strong Borders and will never accept people coming into our Country illegally!”