Republican presidential nominee Donald Trump endorsed House Speaker Paul D. Ryan (R-Wis.) and Sen. John McCain (R-Ariz.) for reelection while campaigning with vice presidential nominee Mike Pence in Green Bay, Wis., on Aug. 5. (The Washington Post)

Capping a week of backbiting between Donald Trump and Republican leaders, the GOP presidential nominee on Friday sought to end a high-stakes impasse by delivering a formal endorsement of U.S. House Speaker Paul D. Ryan’s reelection bid after initially refusing to do so.

“We will have disagreements, but we will disagree as friends and never stop working together toward victory. And very importantly, toward real change,” Trump said during a campaign event in Green Bay, Wis., on Friday evening. “So in our shared mission to make America great again, I support and endorse our speaker of the House, Paul Ryan.”

When asked for the speaker’s reaction, a spokesman said: “He appreciates the gesture and is going to continue to focus on earning the endorsement of the voters in Southern Wisconsin.”

Trump ignited a firestorm in his party this week when he pointedly withheld his endorsement from Ryan, who faces a primary challenge Tuesday. That infuriated Republican leaders close to Ryan — and in particular the Republican National Committee chairman, Reince Priebus, himself from Wisconsin — who have sought to project party unity as the general election season hits its stride.

Trump sought to move beyond that feud Friday, flashing two thumbs up as he formally endorsed Ryan, Sen. John McCain (Ariz.) and Sen. Kelly Ayotte (N.H.) for reelection.

Trump received a cold shoulder from several high-profile Republicans on Friday in Wisconsin, where he hosted an evening rally in Green Bay. Neither Gov. Scott Walker nor Ryan was expected to attend the rally, Trump’s first in the state since its April primary.

Walker, along with Priebus, attended a campaign event last week in Waukesha, Wis., with Trump’s running mate, Indiana Gov. Mike Pence.

Wisconsin House Speaker Robin Vos, in an op-ed published on a conservative website Friday, said he was “heartbroken” over Trump’s decision to voice support for Ryan’s primary opponent, Paul Nehlen, in a tweet. Trump had praised Nehlen on Monday. Vos added that Trump “might be able to repair the damage, but it can’t be ignored.”

“Welcome to Wisconsin, Mr. Trump, but let’s get something straight — we are Ryan Republicans here in Wisconsin, not Trump Republicans,” he wrote.

The controversy made little strategic sense; instead, Trump had appeared to be engaging in score-settling by echoing comments Ryan made this year before he endorsed Trump. “I’m just not quite there yet,” Trump told The Washington Post on Tuesday in reference to endorsing Ryan. The heightened tensions could be particularly damaging for Trump’s unconventional campaign operation, which still depends heavily on the RNC for ground operations and fundraising.

Meanwhile, rival Hillary Clinton appeared increasingly bullish Friday about Democrats’ retaking the Senate and picking up seats in the House of Representatives. Trump’s weaknesses as a candidate, Clinton said, would strengthen her chances not just of winning the White House but also of putting forward a bold policy agenda in January — notably, comprehensive immigration reform.

Republican presidential nominee Donald Trump campaigned in Des Moines on Aug. 5. (The Washington Post)

“I’m hoping that the outcome of the election, which I am working hard to ensure [is] a victory, will send a clear message to our Republican friends that it’s time for them to quit standing in the way of immigration reform,” she told reporters at a convention of black and Hispanic journalists in Washington.

“There’s nothing like winning to change minds,” Clinton said, adding that the “political landscape” favors passage of the long-shelved legislation.

Trump acknowledged during his campaign event Friday that he would need the help of various party factions.

“I need a Republican Senate and House to accomplish all of the changes that we have to make. We have to make them,” Trump said. “I understand and embrace the wisdom of Ronald Reagan’s big tent within the party. Big, big tent, remember? Ronald Reagan. Great man. Great guy.”

Ryan’s team appeared caught unawares Friday afternoon when news began to circulate about Trump’s potential endorsement. During a radio interview with WISN’s Jay Weber on Friday morning, Ryan said he was unsure where things stood with Trump. He repeated several times throughout the morning that he was not seeking Trump’s endorsement and that his constituents — “our employers in Wisconsin” — are his top priority.

“Heck if I know,” Ryan said when asked about the status of his feud with Trump. “I’m not going to try to psychoanalyze this stuff.”

Asked later by radio host Charlie Sykes whether there was something sufficiently disturbing that Trump could do to make Ryan rescind his endorsement of the GOP nominee, Ryan responded: “With any endorsement of anybody, there’s never a blank check. And you know that, and that’s how I’ve always felt.”

He added, “I see no purpose in doing this tit-for-tat, petty back-and-forth with Donald Trump, because it serves no purpose, in my mind.”

The Clinton campaign has regularly sought to capitalize on the persistent tensions between Trump and his party’s leadership by pointing to intraparty attacks against the GOP presidential nominee. On Friday, the Clinton campaign released an ad featuring several high-profile Republicans denouncing the GOP nominee.

Trump, meanwhile, tore into Clinton on Friday during a campaign event in Des Moines.

“She’s really pretty close to unhinged, and you’ve seen it, you’ve seen it a couple times . . . and she’s like an unbalanced person,” Trump said, as the crowd raucously shouted, “Lock her up!”

Trump gave a thumbs-up as the crowd chanted. He added later that electing Clinton would lead to “the destruction of our country from within.”

Clinton’s running mate, Sen. Tim Kaine (Va.), also was in Wisconsin on Friday. He focused his 25-minute speech at a Milwaukee rally on attacking Trump.

He also took a veiled shot at Walker, the governor, as he congratulated Wisconsin over a challenge to its new voter ID law.

“You’ve got governors out there trying to screw around and keep people from voting,” Kaine said to loud cheers.

“Wisconsin, you know how to win,” Kaine said. “You’ve done it again and again and again.”

Robert Costa in Janesville, Wis., Kay Nolan in Milwaukee and Abby Phillip in Washington contributed to this report.