The fierce crosswinds battering the House Republican effort to replace the Affordable Care Act are straining the fragile détente between President Trump and House Speaker Paul Ryan.

The immediate problem for Trump and congressional Republicans is escaping the legislative quagmire that has quickly enveloped their crusade to uproot former President Obama’s ACA. The longer term challenge is bridging the distance between the Trump and Ryan visions of the GOP’s agenda and coalition, which the turmoil over the health legislation has exposed.

The “America First” agenda that Trump rode to the White House braids two distinct strands of conservative thought. The first is an insular nationalism hostile to foreign influences (immigrants, Muslims, international trading partners) and domestic elites (government, cosmopolitan liberals, and corporate leaders). The second is a qualified reassessment of traditional Republican attitudes toward government. Trump shares the conventional Republican determination to slash taxes, regulation, and spending—particularly on transfer programs for the poor—but has carved out one big exception. He has pointedly embraced government programs that benefit his blue-collar and older white base, including Medicare, Social Security, and infrastructure spending.

Ryan steers by very different stars. Throughout his career, he’s rejected economic nationalism and championed trade and immigration. As a disciple of the late Jack Kemp, Ryan has pushed the party to welcome more minorities—while Trump, for example, more commonly portrays undocumented immigrants or inner-city gangs as threats to his preponderantly white supporters. Conversely, Ryan has been much more ideologically doctrinaire than Trump about cutting taxes and spending. That includes entitlement programs, like Medicare, that benefit the older and blue-collar whites who are central not only to Trump’s coalition, but also to the GOP House majority.

The Trump administration’s early weeks have been a delicate minuet between these contrasting perspectives, which can be simplified as nationalism and libertarianism. Trump has emphasized nationalism in his own actions, including executive orders withdrawing from the Trans-Pacific Partnership trade agreement, escalating efforts to deport undocumented immigrants, and restricting immigration from initially seven—now six—Muslim-majority nations. During the campaign, Ryan criticized all of those ideas. But since Trump’s victory, the speaker has defended them.

Trump and Ryan have also found common cause in rolling back federal regulations, particularly those concerning energy production and climate change. That cause unites conservative nationalists and libertarians.

But as the health-care debate shows, the seams are more visible on questions related to federal spending. Trump struck the first blow in late February when he previewed his three-pronged guidance for the federal budget. Trump aligned with Ryan and other congressional Republicans by promising to increase defense spending and severely cut domestic discretionary programs. Those programs, in fields like education and scientific research, provide the federal government’s principal investments in the future productivity of younger people, a racially diverse and mostly Democratic constituency.

But Trump decisively departed from libertarian Republicans by reaffirming his campaign pledge to block cuts to Medicare and Social Security. Those programs benefit an older population that is predominantly white (about three-fourths of all Americans over age 45 are white) and heavily Republican (whites over 45 provided over half of all Trump’s votes). With his pledge to protect Medicare, Trump elevated his nationalist agenda over Ryan’s libertarian-flavored drive to restructure the program into a “premium support” system that shifts financial risk from government to seniors.

The health-care struggle flips this order. Trump has embraced Ryan’s blueprint to radically retrench the ACA while cutting taxes for the wealthy. But in its devastating analysis of the Ryan plan, the Congressional Budget Office reaffirmed what I’ve called the Trumpcare conundrum. The plan would lower costs for younger and healthier people, many of whom now lean Democratic. At the same time, it would raise premiums—by as much as 25 percent—and swell the uninsurance rate for older adults ages 50 to 64, who now mostly vote Republican.

In that way, the House repeal bill embodies a pre-Trump ranking of GOP priorities: It subordinates the president’s pledge to protect those families to Ryan’s determination to systematically shrink government. “The House GOP Obamacare replacement bill … continues to make cost control a higher priority than health-insurance coverage for working families, and as such is not likely to be well received by the non-Republicans whose votes [elected] Donald Trump,” said Henry Olsen, a senior fellow at the conservative Ethics and Public Policy Center. “Trump’s implicit promise that he was a different type of Republican when it came to spending and the role of government … will be sorely tested if this bill is not amended.”

Ryan’s deference to Trump’s nationalism on trade and immigration, and Trump’s acceptance of Ryan’s libertarian approach to health care, has left the GOP with a policy mix crisscrossed by contradiction. In an interview, Neera Tanden, president of the liberal Center for American Progress, noted that the Trump-like European populist parties all combine suspicion of immigrants and trade with support for a generous welfare state, which often includes expanded retirement benefits and a higher minimum wage.

Trump appeared to be heading in that direction, too. But by embracing Ryan’s ACA alternative, the president is now threatening the economic security of his working-class base, even as he loudly expresses their cultural anxieties on such issues as immigration. Trump’s risk is that this incongruence loosens his moorings at both ends: The cultural nationalism could repel minorities and white-collar whites, while the economic libertarianism disillusions working-class and older whites.

“Throughout the world,” Tanden said, “there isn’t a model of success for the marriage of xenophobia with libertarianism.” House Republicans can’t be entirely sure whether Trump will try to disprove that rule—or cut his losses and abandon their beleaguered health-care crusade.