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 election, and 10 years to the day after Obama won the White House in 2008.

In Macon, Ga., 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, Ind. “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, the Georgia gubernatorial race was rocked by last-minute accusations of hacking and leaders of both parties voiced cautious optimism about their chances on Tuesday.

Abrams did not address the controversy, sticking to her usual stump speech during a spirited rally in a community center gymnasium in Augusta.

But Francys Johnson, a minister and candidate for Georgia’s 12th Congressional District, took Kemp to task for his stewardship of the state’s election system. He reminded he crowd of a major data breach that exposes voters’ personal information and Kemp’s dismissal of the notion of Russian hacking in rejecting assistance from the Obama administration.

“The devil has been busy today, talking about the Democrats hacking the voting rolls. He wasn’t afraid of Russian hacking, but he’s afraid of Democratic hacking,” Johnson said, drawing laughter and applause.

Referring to Kemp’s failed bid for state agricultural secretary in 2006, Johnson said: “Maybe he would do a better job shoveling manure, because he sure can’t run an election.”

Ronna McDaniel, chairman of the Republican National Committee, appears in Indianapolis last month. (Michael Conroy/AP)

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.

In remarks before leaving the White House for Sunday’s rallies, Trump predicted that his campaign-trail efforts had made a difference in “five or six or seven” of this year’s Senate races. He also dismissed criticism that he has veered away from talking about the economy, telling reporters, “Well, I do focus on the economy, but you people don’t like to cover that.”

Obama, who has been active on the campaign trail in the weeks leading up to the midterm election, 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.

Former vice president Joe Biden, who is considering 2020 White House bid, spent the final Sunday before Election Day rallying Democrats as well at a pair of rallies in Pennsylvania, the state where he was born.

“As you can tell by my voice, I’ve been traveling a lot,” a hoarse Biden said in Harrisburg, telling the crowd that he had campaigned for 63 candidates in 22 states. He prompted cheers when he issued a veiled rebuke of Trump, saying that Democrats choose “hope over fear” and “unity over division,” and “most of all, we choose truth over lies.”

Trump mentioned Obama by name several times during his rally for Georgia Republican gubernatorial nominee Brian Kemp in Macon, 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 and appeared to voice dissatisfaction with news coverage of the rallies.

“They’ll say, ‘President Trump and former president Obama had wonderful crowds,’ ” Trump said of the media.

Trump and Vice President Pence later flew to Chattanooga, Tenn., where they rallied support for Republican Senate nominee Marsha Blackburn. Trump drew raucous applause when he pledged to “keep criminals and drug dealers the hell out of our country.”

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 among his mostly white supporters in an attempt to increase Republican turnout.

Late last week, Trump’s campaign announced that it was spending $1.5 million on a TV ad featuring footage of Luis Bracamontes, an undocumented immigrant who was convicted of killing two sheriff’s deputies in California in 2014.

“They all say, ‘Speak about the economy. Speak about the economy,’ ” Trump told a crowd in Huntington, W.Va., on Friday night. “Well, we have the greatest economy in the history of our country, but sometimes it’s not as exciting to talk about the economy, right?”

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.”

The group of migrants now numbers about 4,000 and is in Mexico, hundreds of miles from the U.S. border. 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.”

Republican National Committee Chairman Ronna McDaniel defended the president’s ramped-up rhetoric on immigration and race, arguing that it’s possible to focus on several issues at once.

“Well, I’m with him,” she said in an interview on CNN’s “State of the Union” when asked about Trump’s comments on the economy. “He’s talking about both. . . . He can talk about multiple things at once.”

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

Georgia’s gubernatorial race took center stage Sunday, as Kemp’s office announced a “hacking” investigation of the Georgia Democratic Party and his campaign condemned the “criminal behavior” he allegedly discovered. Kemp, who as secretary of state oversees Georgia’s elections, did not provide any evidence, and his announcement was criticized by voting rights lawyers as well as Democratic nominee Stacey Abrams (D), who suggested that the investigation was “nothing more than a pathetic attempt to cover up for his failures.”

On the Sunday morning news shows, leaders of both parties were optimistic about their chances Tuesday.

In an appearance on ABC’s “This Week With George Stephanopoulos,” Sen. Chris Van Hollen (D-Md.) said he wouldn’t predict how he thinks the election will go, but he called it a “sea change” that there is still a “narrow path to the majority” in the Senate for the Democratic Party.

Van Hollen, chairman of the Democratic Senatorial Campaign Committee, credited individual candidates with focusing on the issues that matter in their home states.

And in a preview of the contentious leadership battle that awaits House Democrats after Election Day, Rep. Tim Ryan (D-Ohio) signaled Sunday that he could run for speaker if the Democrats take control of the House, saying he thinks it would be wise to elevate someone from Ohio who represents a “blue-collar area.”

“I think it’s important that we have this discussion and have this conversation,” said Ryan, who challenged Minority Leader Nancy Pelosi (D-Calif.) for the party’s top spot in 2016. “I think the American people want a change. I think a lot of Democrats want a change. And so we’re going to have that discussion starting on Wednesday, and let’s hope we’re having that conversation about speaker of the House and not leader of the minority party in Congress.”

The congressman has said for months that he would consider another run against Pelosi. He said Sunday that several candidates will vie for the speaker position if the Democrats win, and that it “will not be a coronation.”

Rep. Steve Scalise (R-La.) said on Fox News Channel’s “Sunday Morning Futures” that he thinks Republicans will hold on to the House majority, and that Majority Leader Kevin McCarthy (R-Calif.) should replace Speaker Paul D. Ryan (R-Wis.), who isn’t seeking reelection. That would open up McCarthy’s No. 2 spot, a post Scalise acknowledged he is interested in.

McCarthy would face a challenge from Rep. Jim Jordan (R-Ohio), who announced a bid for speaker earlier this year.

Gearan reported from Macon. Dan Lamothe in Washington and Vanessa Williams in Augusta, Ga., contributed to this report.