President Trump speaks during a signing ceremony for the “Strengthening Career and Technical Education for the 21st Century Act” at Tampa Bay Technical High School in Florida. (Evan Vucci/AP)

President Trump’s tight grip on the Republican Party is being openly challenged by the powerful network of ideological conservatives linked to billionaire industrialist Charles Koch, splaying out long-simmering tensions over the party’s future just months before the midterm elections.

Trump on Tuesday dismissed the mounting criticism of his trade and immigration policies from Koch and his allies as the battle cry of a faction that has “become a total joke in real Republican circles.”

“I don’t need their money or bad ideas,” Trump wrote on Twitter, adding, “I have beaten them at every turn.”

The Koch network pointedly declined to endorse Trump as a presidential candidate in 2016. But this latest feud — following last weekend’s gathering at which Koch-affiliated officials sought to distance their operation from Trump — has exposed the rift between a president pushing his party toward populism, and establishment Republicans espousing the long-standing policy of free trade.

Republican lawmakers, awkwardly stuck between two of the party’s most influential forces, are scrambling to adjust. On Monday, GOP senators privately deliberated about the path the Koch network has charted and its implications, according to two Republicans familiar with the discussions who spoke on the condition of anonymity because they were not authorized to speak publicly.

In a private meeting at the Capitol, Sen. John Cornyn (R-Tex.) recounted his visit to the Koch conference to Senate Majority Leader Mitch McConnell (R-Ky.) and other GOP senators and aides, and described the frustration he encountered over Trump’s trade policies and conduct, the Republicans said.

Some senators in the meeting struggled to make sense of the Koch network’s new strategy of limiting its work for GOP candidates.

“These guys want to change the direction of the country. They don’t understand how hard that is,” McConnell said, according to one of the Republicans.

Representatives for McConnell and Cornyn declined to comment, citing a practice of not discussing private meetings.

Trump supporters expressed outrage Tuesday at what they saw as a betrayal.

“The donor class controlled the Republican Party — that is, until the rise of Trump. The Kochs see that being ripped away, thus the open contempt for the president and his movement,” said former White House chief strategist Stephen K. Bannon.

Trump’s critics, however, said the fissures within the Republican Party have only grown over the past year, and they called the split a sign of wider unease.

“The Kochs are rather appalled at what they’re seeing from Republicans who they helped elect in 2010, 2014 and 2016 — and who promised to be fiscally responsible and support free markets,” said conservative activist Erick Erickson, who has worked with Koch-affiliated groups and who will host a conservative summit this week in Austin that is partly sponsored by the Koch Institute.

While much of Trump’s agenda, such as the GOP-authored tax law and a sweeping rollback of regulations, has heartened the party’s business wing and libertarian-leaning leaders, there remains resistance to Trump’s raw populism and economic nationalism, which many traditional Republicans have argued for decades is the antithesis of conservative principles.

Those frictions, often latent during Trump’s presidency because of his popularity with core Republican voters, have now erupted ahead of November’s elections, with the GOP striving to protect its congressional majorities and increasingly debating whether to rally with Trump or against him.

The Koch network — which over the past decades has become a robust conservative grass-roots organizing and advertising apparatus with a heft comparable to that of the Republican National Committee — has pledged to spend as much as $400 million in this election cycle on policy issues and campaigns.

The Koch groups are quickly choosing sides with little reservation, cautioning Republicans who are ardent supporters of the president’s trade and spending policies that they are at risk of being opposed.

“It brings home how much Trump has broken with traditional Republicans,” said conservative commentator William Kristol, a Trump critic. “Voters may matter more than the Kochs, but Trump keeps opening up these avenues for others to start criticizing him or breaking away, whether it’s the anti-government and free-trade Kochs or the Republican hawks on foreign policy.”

On Monday, the Koch network announced that it does not plan to support Rep. Kevin Cramer (R-N.D.) in his campaign to unseat Democratic Sen. Heidi Heitkamp, who is running for reelection in a state that Trump won by more than 35 percentage points. Trump held a campaign rally for Cramer in June.

“They just flat-out threw him under the bus in front of this full room of people,” said an attendee of the Koch conference who was not authorized to speak publicly. “I hadn’t heard them do that before.”

Republican officials on Tuesday privately interpreted what the Kochs did as a warning shot, meant to convey that siding with Trump, while politically enticing, will carry a political cost with their groups.

Most Republican senators were treading carefully Tuesday since they are eager to win support both from Trump and from Koch-aligned donors — a balancing act that could be difficult as tensions flare.

Sen. Tim Scott (R-S.C.), who attended the Koch summit, said, “It’s their money and their choices,” adding, “They’ve got to make their decisions.”

Dan Eberhart, an oil industry executive and a Cramer fundraiser, downplayed the financial effect on the North Dakota race.

“I don’t necessarily think the Kochs splitting a little from the GOP makes it harder to fundraise,” said Eberhart, who attended the Koch summit and stands by Cramer. “The success of the tax cuts and the importance of the Supreme Court energizes GOP donors to keep the Senate in Republican hands.”

Cramer, a Trump backer, has told allies he remains confident about his chances and will continue to support the president.

“I respect the decision by the Koch Network to not engage in the North Dakota Senate race,” Cramer said in a statement. “My voting record may not be exactly what every national organization wants, but it is exactly what the majority of North Dakotans expect.”

Other Republicans said they were optimistic that the warring wings of the party could reconcile before the elections, in which the GOP is trying to stave off a possible Democratic wave.

“The Koch network has had tremendous impact on helping us who wanted to change the direction of the country a couple years ago,” Sen. David Perdue (R-Ga.), a former corporate leader and Trump ally, said in an interview. “I can’t imagine people in the Koch network supporting a Democrat in some of those elections.”

Former House speaker Newt Gingrich, another Trump ally, took a darker view. “Charles and his people are drawing the line in the sand. They know Trump represents a fundamental break with their approach,” he said.

The Kochs are not the only prominent Republican family that has evolved in its engagement with the GOP in the past year. Billionaire Robert Mercer and his daughter, Rebekah, have supported a few conservative Senate candidates but have broken with Bannon, their longtime adviser, and kept a decidedly low profile compared with their all-out support for Trump in 2016.

The clash between the president and the Koch network is more of an expected divorce than a stunning breakup, according to more than a dozen Republicans working with Congress and the White House.

Several Trump administration figures — including Vice President Pence and his chief of staff, Nick Ayers, plus Secretary of State Mike Pompeo — have cultivated strong ties to the Kochs for years, before and after the 2016 campaign, when Trump criticized Koch-backed politicians as “puppets.”

But the president and most of his loyalists never warmed to the Kochs, even as their interests at times have aligned. Marc Short, a former Koch operative, left his post as White House legislative director in July.

Trump’s backing has been crucial for some of the network’s biggest legislative efforts, including overhauling the Department of Veterans Affairs. Yet the trade war brewing under his leadership has jarred the anti-protectionist coalition, which was created in 2003 when Charles Koch convened a small group of like-minded business leaders to oppose steel tariffs and rising federal spending under the George W. Bush administration.

Koch opened his twice-annual conference in Colorado last week by offering the more than 500 major donors in attendance an impassioned critique of protectionism, which he called a “destructive” force that is “perverting the key institutions of our society.” Later, Koch political associates railed against Trump’s recent $12 billion in emergency aid to farmers as a “bailout of bad policy.”

Koch, 82, has been at the helm of his family’s political organization since his younger brother, David, announced in June that he would be retiring from Koch Industries and politics for health reasons.

Speaking to reporters Sunday, Charles Koch said he was determined to take on Trump’s policies, not the president personally.

“We’ve had divisiveness long before Trump became president,” Koch said. “I’m into hating the sin, not the sinner.”

Michelle Ye Hee Lee and John Wagner contributed to this report.