House Speaker Paul D. Ryan stepped in front of cameras Tuesday and delivered just the sort of high-minded, clear-eyed, aspirational message that has made him a Republican Party standard-bearer.

”This party does not prey on people’s prejudices; we appeal to their highest ideals,” he said. “We believe all people are created equal in the eyes of God and our government. This is fundamental, and if someone wants to be our nominee, they must understand this.”

Moments later, asked what if that nominee were in fact Donald Trump — who days before had balked at denouncing the Ku Klux Klan — he was forced to retreat from the moral high ground. “I plan to support the nominee,” he said.

When he was drafted into the speaker’s chair four months ago, Ryan acknowledged the job would be difficult. But, thanks to Trump, it has become much worse than that. He has come to embody the party establishment’s existential conflict: deeply wary of Trump’s divisive antics but reluctant to reject him entirely.

“It’s not nearly as complicated for us as it is for him,” said Peter Wehner, a Ryan friend and senior fellow at the Ethics and Public Policy Center who was among the first conservative thinkers to renounce Trump. “His is a different role, and it’s a trickier role, and it requires a lot of prudence, frankly.”

Prudence, however, has gotten Ryan only so far politically. The expected complications of managing the House Republican majority have only been compounded by Trump’s unexpected endurance. Ryan’s attempts to sail above the presidential fray with an emphasis on big ideas and basic legislating have been undermined both by hard-line House conservatives and by an angry presidential front-runner who all but mocks the reverence for the party’s leading “ideas man.”

“Paul Ryan, I don’t know him well, but I’m sure I’m going to get along great with him,” Trump said Tuesday. “And if I don’t, he’s going to have to pay a big price, okay?”

House conservatives, meanwhile, are making it all but impossible for Ryan to strike a GOP consensus on spending, setting the stage for the same type of contentious year-end budget negotiations that bedeviled his predecessor, John A. Boehner.

Ryan has undoubtedly kept his sunny disposition. He has embraced his role as a leading GOP communicator on cable TV and talk radio, has proved to be a prodigious fundraiser, and continues to enjoy support across the House Republican conference.

“Speaker Ryan is the ultimate optimist, and the job has only energized him,” said Ryan spokeswoman AshLee Strong.

Ryan spoke recently with Trump, Strong said. The call allowed Ryan “to explain House Republicans’ plan to present a bold conservative policy agenda this year,” she said in an email. Ryan has also spoken with Sen. Ted Cruz (R-Tex.) and plans to speak with the other GOP presidential candidates soon. “He will have similar calls with Senator [Marco] Rubio and Governor [John] Kasich soon.”

Trump spokeswoman Hope Hicks confirmed the two spoke: “Mr. Trump likes and respects the Speaker very much.”

But well-laid plans for the year ahead are hanging by a thread. He has been locked for weeks now in a standoff with hard-liners who want to back out of the bipartisan spending agreement Boehner struck last year. That deal includes $30 billion in new spending and was supposed to set up a drama-free budget process ahead of the election in November.

Ryan has urged his colleagues to honor the agreement, arguing it will show the GOP-controlled Congress can effectively govern while giving rank-and-file lawmakers the influence they desire over individual spending bills. But that argument is falling flat with members who are mindful of the anti-establishment fervor stoked by Trump’s success and are balking at boosting spending.

Rep. Tom Marino (R-Pa.), one of the five congressional Republicans to have endorsed Trump, said conservatives are simply listening to voters. “Overwhelmingly in my district, people are tired of insiders,” he said.

Even members who don’t back Trump say it is impossible to ignore the sense that the voters want to shake up Washington, even if it means discarding Ryan’s plans. “If we dismiss the national sentiment out there, we do it at great peril,” said Rep. Bill Flores (R-Texas), who has not endorsed a presidential candidate.

The reprise of the spending fight has forced Ryan to spend weeks trying to keep his conference united on tactics, while his quest to animate Republican voters through policy has been all but overwhelmed by the Trump spectacle. He increasingly finds himself being asked to respond to whatever controversy Trump has stoked that day or week.

“No politician wants to have to be in the position where they have to denounce the comments of a member of their own party,” said Rep. Charlie Dent (R-Pa.). “It’s a terrible position to be in, and with Donald Trump — how many times will you have to do this?”

Addressing reporters Thursday, Ryan said he had laughed off Trump’s “pay a big price” threat and played down his own ability to shape the presidential race. In declining further comment on Trump, he emphasized, as he has previously, his special role as chairman of the Republican National Convention.

”As speaker of the House, what can I do about it, what can I control?” he said. “I can help put substance in this campaign. The way we see our role in this campaign, through our agenda project, is to add a keel and a rudder to this ship of the Republican Party, and give it direction.”

Ryan appointed five task forces last month to develop detailed policy agendas on such issues as national security, health care and federal regulations. But on numerous ideas close to Ryan’s heart — free trade, immigration reform, tax reform, entitlement cuts — Trump holds conflicting, if not opposing views.

Asked what use his agenda will be if Trump is the nominee, Ryan said, “Look, we’re going to speak out for who we are and what we believe; we’re going to run on our beliefs, we’re going to run on our ideas. I’ll just leave it at that.”

Ryan counts himself as a proud “movement conservative,” but that does not describe the bulk of the Trump base. “Trump has Democrats supporting him, and people who are not even anywhere in the same camp about spending,” said Rep. Pat Tiberi (R-Ohio), a close Ryan ally.

The Democratic Congressional Campaign Committee highlighted the chasm between Trump’s angry populism and Ryan’s happy-warrior conservatism when it circulated a mock obituary for Ryan’s “Year of Ideas” on Friday.

“It met its untimely and early end at the hands of a Republican electorate that is simply not interested in policy and good governance,” it read.

Wehner said if Trump progresses toward the nomination, he may have no choice but to make amends with Ryan.

“There are going to have to be some people who are going to have to deal with him that are responsible and sane human beings, and Ryan is one of them,” he said. “Trump has zero ideas, he has no governing philosophy, he has no governing agenda, he’s got nothing. And presumably he’s at some point going to figure out that he needs something, and Paul Ryan is probably the best person in the Republican Party to fill that void.”

Speculation persists that, should Trump fail to secure a majority of delegates, Ryan might emerge from a chaotic convention as a consensus presidential nominee. A “Committee to Draft Speaker Ryan” super PAC was registered with federal elections officials this week.

In a Friday letter to regulators, an lawyer for Ryan disavowed the effort. “Speaker Ryan has repeatedly announced publicly that he is not running for President in 2016,” attorney Timothy E. Kronquist wrote.

Dent, who has endorsed John Kasich, said he believes Ryan has longer-term interests in mind than the outcome of this year’s presidential election.

“Paul Ryan’s first interest is protecting his House majority, not the presidential nominee,” Dent said. “If he sees the presidential nominee making statements he considers to be destructive to the interests of the Republican Party, Paul should step up and call it out. He has to; I think he has no choice.”

“Whether or not he endorses the nominee if it’s Trump,” he added, “it’s up to him.”