Frustrated Republicans say it's time for the Senate to reclaim more power over foreign policy and are planning to move a measure Thursday that would be a stunning rebuke to a president of their own party.

GOP lawmakers are deeply concerned over President Trump's reluctance to listen to his senior military and intelligence advisers, fearing it could erode national security. They say the Senate has lost too much of its constitutional power over shaping the nation's foreign policy and argue that it's time to begin clawing some of it back.

"Power over foreign policy has shifted to the executive branch over the last 30 years. Many of us in the Senate want to start taking it back," said a Republican senator closely allied with Senate Majority Leader Mitch McConnell (R-Ky.).

They plan to send Trump a stern admonishment by voting Thursday afternoon on an amendment sponsored by McConnell warning "the precipitous withdrawal" of U.S. forces from Syria and Afghanistan "could put at risk hard-won gains and United States national security."

The resolution also expresses a sense of the Senate that the Islamic State in Iraq and Syria (ISIS) and al Qaeda pose a "continuing threat to the homeland and our allies" and maintain an "ability to operate in Syria and Afghanistan."

It's a pointed rebuttal to the claim Trump made on Twitter in December that "we have defeated ISIS in Syria."

Speaking on the Senate floor, McConnell said his amendment "simply re-emphasizes the expertise and counsel offered by experts who have served presidents of both parties," a subtle rebuff of Trump's tweets from earlier in the day mocking his intelligence advisers as "naive."

Trump stunned Republican senators Wednesday by lashing out at Director of National Intelligence Dan Coats and CIA Director Gina Haspel after they contradicted some of his optimistic claims about the threats posed by North Korea and ISIS. The senior intelligence officials also angered Trump by testifying that Iran is in compliance with the nuclear treaty it signed with Western powers under the Obama administration.

Trump tweeted "the Intelligence people seem to be extremely passive and naive when it comes to the dangers of Iran. They are wrong!" The president added in a follow-up tweet about Iran: "Perhaps Intelligence should go back to school!" Trump appeared to be responding to television news coverage that focused on how the testimony contradicted his views on global threats.

Exasperated Republican lawmakers quickly pushed back against the criticism, urging the president to show more restraint.

"I don't know how many times you can say this, but I would prefer that the president stay off Twitter, particularly with regard to these important national security issues where you've got people who are experts and have the background and are professionals," said Senate Republican Whip John Thune (S.D.). "In most cases I think he ought to, when it comes to their judgment, take it into consideration."

Thune praised Coats, a former senator, as "an incredibly capable, principled guy" who "is very committed to doing the right thing for the country." Thune predicted that most Republican senators will vote for the resolution urging Trump to exercise caution in assessing troop forces in Syria and Afghanistan.

"It reflects the widely held view in our conference - again - you want to trust our military leaders when it comes to some of these decisions," he said.

He added that "a number of our members" talk to the president on a regular basis "and have articulated to him that they think that the policies that currently he wants to employ with regard to Syria, for example, are not the right ones."

Sen. Mitt Romney (R-Utah), who has emerged as a high-profile counterweight to the president on foreign policy issues, said, "I have full confidence in our intelligence community and its leadership. They are highly sophisticated and capable, and I take them at their word."

"Precipitous withdrawal from Syria would put our allies at risk and be detrimental to our allies in the region," he added.

Sen. Roy Blunt (R-Mo.), a member of the Senate Intelligence Committee, said "this is an intel community that the president has largely put in place."

"I have confidence in them, and I think he should, too," he said.

Coats told the Intelligence Committee on Tuesday that U.S. analysts believe "North Korea will seek to retain" its ability to deploy weapons of mass destruction and "is unlikely to completely give up its nuclear weapons and productions capabilities because its leaders ultimately view nuclear weapons as critical to regime survival."

The statement undercut Trump's praise of a declaration made with North Korea last year pledging to normalize relations in exchange for the "denuclearization of the Korean Peninsula."

Coats also testified that U.S. intelligence does not believe that Iran is undertaking any "key activities" to produce a nuclear device. On the subject of ISIS, Coats warned that the group is planning a comeback and numbers thousands of fighters in Syria and Iraq.

Haspel warned that North Korea is committed to developing a long-range missile that could strike the United States and corroborated Coats's testimony that Iran is still in compliance with the nuclear deal.

Trump and some of his supporters have long accused a so-called deep state of national security and intelligence officials of attempting to subvert his presidency. But one former White House official who worked on national security issues chalked up Trump's reaction on Wednesday to his penchant to hit back at critics, no matter who they are.

"Trump is always going to respond to somebody who is going against him or who he thinks is trying to make him look bad," the official said. "It doesn't matter if you're the intelligence community. It doesn't matter if you're the Agriculture secretary."

Sen. John Cornyn (R-Texas), another member of the Intelligence panel, praised Coats and Haspel as "great patriots" who "tell it like it is."

"Sometimes facts are inconvenient," Cornyn said.

"But they work for him," he added, referring to Trump. "He ought to call them on the phone."

Asked about Trump's tweeted criticism, Cornyn said: "Just say no. No more Twitter."

Trump has long disagreed with the intelligence community and the national security establishment on a long list of issues, especially engagement with Russia. That dynamic has caused resentments to fester.

"Whether there is merit to it or not, Trump views the Russia conversation as a direct threat to his legitimacy and he is very sensitive about it," the former official said. "He's not willing to give an inch on that."

The hearings also struck a nerve among some of the president's supporters, which amplified the issue on cable television.

Fred Fleitz, former chief of staff to national security adviser John Bolton, said Coats should be fired over his comments to Congress.

"I gotta tell you, I would let him go because of this and I've thought this for some time," Fleitz said Tuesday in an interview with Fox Business Network's Lou Dobbs, a Trump favorite. "I think Mr. Coats is a great guy, but intelligence is to inform presidential policy. It's not supposed to undermine it. It's not supposed to second-guess presidential policy."

Fleitz also said the intelligence community should stop issuing an unclassified, public assessment of threats to the U.S. because it "undermines" Trump's policies.

"This is crazy. This has to stop," he said.

A turning point for many Republicans was Trump's unexpected announcement on Dec. 19 that "we have won against ISIS" and he would order the withdrawal of 2,000 American troops from Syria. The next day, Secretary of Defense James Mattis announced his resignation, citing policy differences and his concern over the future of U.S. alliances.

Even before that, there was growing sentiment within the Senate GOP conference to constrain Trump's power as commander in chief. Seven Republicans voted with Democrats on Dec. 13 for a resolution directing the president to withdraw U.S. forces from participating in the civil war in Yemen. It marked the first time the Senate successfully passed a resolution under the 1973 War Powers Act, which was enacted to constrain executive power at the end of the Vietnam War.

McConnell has tried to shift focus away from the differences between Trump and Republican senators on national security by highlighting divisions among Democrats over the resolution on Syria and Afghanistan.

"Democrats objected to a vote on this amendment, apparently because it would expose a rift among their membership. A division between those Senate Democrats who still subscribe to this vision for American leadership and their colleagues who have abandoned those principles at the urging of the far left - or are too afraid to take either position," McConnell said on the Senate floor.

Democrats, however, were quick to pounce on Trump's comments and draw a comparison to the president's controversial joint press conference with Russian President Vladimir Putin last year when he appeared to give equal weight to U.S. intelligence findings that Russia interfered in the 2016 presidential election and Putin's categorical denial.

House Intelligence Committee Chairman Adam Schiff (D-Calif.) accused Trump of undercutting U.S. intelligence officials. "It gives a great opening to our adversaries who can discredit our intelligence agencies, who can say: 'Well look, even the president of the United States doesn't believe his intelligence agencies so why should we believe what the intelligence community says about Russia's intervention in our election? Why should we believe what the intelligence community has to say about Iran's compliance with the nuclear deal?' " he said Wednesday.