President Trump and former President Barack Obama headlined dueling rallies Sunday, sparring in unusually personal terms about health care and who deserves credit for the country’s recent economic gains.

The spectacle of the president and his immediate predecessor lashing out at each other came two days before the midterm elections, and 10 years to the day after Obama won the White House in 2008.

In Macon, Georgia, Trump declared that Obama “did not tell the truth” when he told Americans “You can keep your doctor, you can keep your plan” under his signature health-care legislation.

“He said it 28 times, and it wasn’t true,” Trump told the crowd.

Obama delivered his own blistering critique of Trump, accusing the president and Republicans of “just making stuff up” and mocking them for claiming ownership of economic gains that began on his watch.

“The economy created more jobs in my last 21 months than it has in the 21 months since I left office,” Obama said in Gary, Indiana. “So, when you hear these Republicans bragging about, ‘Look how good the economy is,’ where do you think that started? Somebody had to clean it up. That’s what a progressive agenda did.”

The presidential broadsides came as Trump and his allies defended the president’s focus on immigration and leaders of both parties voiced cautious optimism about their chances on Tuesday.

A Washington Post-ABC News poll released Sunday showed that 50 percent of registered voters prefer Democratic House candidates, compared with 43 percent for Republicans. Democrats need to gain 23 seats to retake the House and two seats to reclaim a Senate majority.

Obama, who has been active on the campaign trail in the weeks leading up to the midterm elections, spoke with a rasp in his voice Sunday as he took aim at Trump, telling the crowd that “the character of our country is on the ballot” and accusing Republicans of “shamelessly” lying.

“Unlike some people, I don’t just make stuff up when I’m talking,” Obama said at a rally to support Sen. Joe Donnelly, D-Ind. “I’ve got facts to back me up. I believe in fact-based campaigning. I believe in reality-based governance.”

Hammering on a theme that Democratic candidates have made a centerpiece of their efforts to retake control of Congress, he contended that if Republicans “want to stand up and defend the fact that they tried to take away your health care, they should do so” rather than “pretend they didn’t do it.”

Later, at a rally for Illinois gubernatorial nominee J.B. Pritzker and other candidates in Chicago, he suggested that Republicans were supporting efforts to make it more difficult for people to vote.

“Why is it that we kind of take for granted, like, one party that specifically institutes programs to prevent people from voting? It’s a very undemocratic idea,” he said.

Trump mentioned Obama by name several times during his rally for Georgia Republican gubernatorial nominee Brian Kemp in Macon, Georgia, the first of two such gatherings the president attended Sunday.

At one point, Trump suggested that his own crowds were bigger than those at Obama’s recent events.

A monthly jobs report Friday showed that hiring and wages grew more than they have in nearly a decade, a boon for Trump and Republicans on the verge of the election.

But to the chagrin of some leading members of his party, Trump has responded by de-emphasizing the economy and stoking fears about illegal immigration.

Trump took a particularly harsh line on the issue Sunday as he vowed to cut foreign aid to Central American nations he said had done nothing to stop a group of migrants traveling toward the United States.

“How about that caravan? Do you want to let that caravan just pour in?” Trump asked in Macon, as the crowd answered with a chant of, “Build that wall.”

Trump, who has ordered more than 7,000 active-duty troops to deploy along the Mexican border in Arizona, California and Texas, described the approaching caravan as “an invasion.”

Trump will make one final campaign-trail foray Monday, when he headlines rallies in Cleveland; Fort Wayne, Indiana; and Cape Girardeau, Missouri.