Wading into the final days of Pennsylvania's critical U.S. Senate race, President Obama rebuked Sen. Pat Toomey on Saturday over a new television ad featuring the president's previous words of praise.

Obama's intervention pointed to the huge stakes and narrow margins in a contest with national implications.

His criticism arrived as Democratic candidate Katie McGinty wrapped herself in the embrace of her party's biggest stars - and while Toomey tried to appear closer to Obama than his own party's presidential nominee, Donald Trump.

Fighting for the crossover votes vital to his political survival, Toomey has begun running television ads in Philadelphia and Pittsburgh highlighting Obama's praise for his 2013 bill to expand background checks on gun buyers. That measure, introduced in the aftermath of the Sandy Hook school massacre, has become central to Toomey's appeal to moderate voters and, he hopes, some Democrats.

Obama, however, made clear he supports McGinty - who joined rallies Saturday with Hillary Clinton and Vice President Biden. The president slammed Toomey for refusing to take a stand on Trump.

"Pat Toomey may have done the right thing on one vote, but courage is telling Pennsylvania voters where you stand on the tough issues, not just the easy ones like background checks," Obama said in a statement released by Democrats' Senate campaign arm. "Pat Toomey won't tell Pennsylvania voters where he stands on Donald Trump. . . . That's not courage."

The competing events, rallies, and jabs came as Toomey and McGinty each sought a late edge in their bare-knuckle contest.

Democrats need to gain five seats to take control of the Senate (four if Clinton wins the White House). The battle features six key races going down to the wire.

Pennsylvania's contest is among the country's most watched - and has become the most expensive Senate campaign in history, with more than $150 million spent, according to the nonpartisan Center for Responsive Politics.

Most public polls suggest McGinty has a small lead, with Toomey within striking distance. He said his campaign data show a "dead heat."

Toomey defended using the president's words.

"President Obama stood up publicly and praised my work of reaching across the aisle and trying to get something done on an important issue. . . . The other side has tried to discredit and deny the work that I did," Toomey said after a morning campaign stop in West Chester. "I think President Obama said it well, so we used his clip. It's his quote."

Toomey's support for the background-check bill also earned him support from two prominent gun-control groups, backing he has touted while trying to win swing votes.

His Obama ad, though, brought retaliation: A Democratic group that does not reveal its donors launched two late commercials hammering the senator for opposing proposed bans on assault weapons.

Toomey, saddled with the divisive Trump atop the GOP ticket, has touted his independence - previously running ads highlighting praise from Clinton's running mate, Tim Kaine, though emphasizing a more conservative message in other parts of the state.

On Saturday he continued his refusal to say if he will vote for Trump. He has not endorsed the GOP nominee but hasn't ruled out doing so.

The senator has painted his indecision - and McGinty's wholehearted support for Clinton - as a reason voters should back him.

"Katie McGinty would be a rubber stamp for Hillary Clinton, and I think Pennsylvanians want an independent voice who's going to stand up to bad ideas from either president from any party," Toomey said.

He zipped to six events Saturday with Sen. Tom Cotton (R., Ark.), a former Army officer who lauded Toomey's national security credentials.

One man listening at a VFW hall in West Chester, Devon resident Bill Sklaroff, said he liked Toomey's background owning a small chain of restaurants.

"He's very honest and he's a good man," Sklaroff said. "He's been very poorly treated by Katie McGinty."

Hours later at a school gymnasium in Bristol, McGinty and Biden spoke to a few hundred supporters, blasting Toomey for refusing to disown Trump.

"The test of leadership and courage and character is doing the right thing even if it costs you a few votes," McGinty said. "Pat Toomey has failed the test."

McGinty plans to campaign with Biden in Scranton and Harrisburg on Sunday.

Outside the Bristol event, Pam Sansores echoed a common refrain from voters: With all the attack ads, she doesn't know what Toomey or McGinty stands for.

While they have stark divides on major issues - including abortion, taxes, the minimum wage, and the Iran deal - their campaigns have focused mostly on accusations of ethical failings and self-enrichment.

Sansores, like several Democrats at the Biden event, said they knew little about McGinty but would vote against Toomey to help secure a Democratic Senate.

@JonathanTamari www.philly.com/capitolinq