WASHINGTON – President Donald Trump threatened Thursday to try to knock off members of the House Freedom Caucus in next year's elections if they don't fall in line — an extraordinary move that laid bare a civil war within a Republican Party struggling to enact an ambitious agenda.

In a morning tweet, the president warned that the powerful group of hard-line conservatives who blocked the health care bill last week would "hurt the entire Republican agenda if they don't get on the team, & fast."

He vowed to "fight them" as well as Democrats in the 2018 midterm elections, a threat that his allies said was intended to make members of the Freedom Caucus think twice about crossing him again. But Trump's vow was met with defiance by many in the group, including some who accused him of succumbing to the establishment in Washington that he had campaigned against.

Later, Trump singled out three of the group's members in another tweet, saying if they got on board, "we would have both great healthcare and massive tax cuts & reform."

Most of the roughly three dozen Freedom Caucus members were elected from very safe Republican districts, and many of them faced no primary opposition in their last election. To make good on his threat, Trump would have to recruit GOP candidates to make the case that the Republican incumbent they face was unhelpful to an unorthodox president.

Trump's frustrations with the Freedom Caucus reflect only part of his challenge in moving legislation, even in a Congress where both chambers are controlled by his own party. If Trump does too much to mollify members of the Freedom Caucus, he risks alienating moderate Republicans in districts won or narrowly lost by Democratic presidential nominee, Hillary Clinton.

And on many pieces of Trump's congressional agenda, he'll need the support of at least some Democrats, particularly in the Senate, an uncertain prospect given the toxic partisan environment on the Hill.

House Speaker Paul Ryan, R-Wis., said that he sympathized with Trump. "I understand the president's frustration," said Ryan, who has been unable to push the health care bill through his own chamber. "About 90 percent of our conference is for this bill to repeal and replace Obamacare and about 10 percent are not. And that's not enough to pass a bill."

Ryan said he had no immediate plans to bring the health care bill back to the House floor, saying it was "too big of an issue to not get right."