WASHINGTON (Reuters) - President Donald Trump on Wednesday called U.S. intelligence chiefs “extremely passive and naive” on Iran and dismissed their assessments of the threat posed by North Korea a day after they contradicted his views during congressional testimony.

His comments drew criticism from some of his fellow Republicans in Congress, some of whom have introduced legislation that would counter Trump’s policies on national security in an unusual break from their party’s leader.

Leaders of the U.S. intelligence community told a Senate committee on Tuesday that the nuclear threat from North Korea persisted and Iran was not taking steps toward making a nuclear bomb, conclusions that contrasted starkly with Trump’s assessments of those countries.

“The Intelligence people seem to be extremely passive and naive when it comes to the dangers of Iran. They are wrong!” Trump, who criticized U.S. intelligence agencies even before he took office, said in a Twitter post.

Trump cited Iranian rocket launches and said Tehran was “coming very close to the edge.”

“Perhaps Intelligence should go back to school!” he said.

Trump last year pulled out of an international nuclear deal with Iran, saying Tehran was “not living up to the spirit” of the agreement, and reimposed sanctions. Under the 2015 deal, Iran agreed to restrictions on its nuclear activities in exchange for the lifting of sanctions.

Slideshow ( 3 images )

The intelligence officials told the Senate Intelligence Committee that Iran was not developing nuclear weapons in violation of the agreement.

Their assessments also broke with other assertions by Trump, including on the threat posed by Russia to U.S. elections, the threat the Islamic State militant group poses in Syria, where he plans to withdraw U.S. troops, and North Korea’s commitment to denuclearize.

“The President has a dangerous habit of undermining the intelligence community to fit his alternate reality,” Senator Mark Warner, the Intelligence Committee’s top Democrat, wrote on Twitter. “People risk their lives for the intelligence he just tosses aside on Twitter.”

Republican U.S. Representative Mike Gallagher, who served as a Marine Corps intelligence officer during the Iraq war, defended the intelligence agencies, saying: “They are doing a very difficult job and they are actually trying to advance the president’s priorities.”

BILL TO REBUKE TRUMP?

Gallagher was one of a group of Republican and Democratic House of Representatives members who announced bills on Wednesday to set strict conditions before the United States could withdraw troops from Syria or the Korean Peninsula. The Democratic-led House overwhelming passed legislation last week reaffirming U.S. support for the NATO military alliance, another target of Trump criticism.

Slideshow ( 3 images )

Republican Senate Majority Leader Mitch McConnell introduced legislation on Tuesday urging U.S. troops to remain in Syria and Afghanistan.

A few Republicans also joined Democrats on Wednesday to reintroduce a war powers resolution, which passed the Senate but not the House in December in the face of Trump’s opposition, seeking to end any U.S. involvement in Yemen’s civil war.

John Thune, the No. 2 Republican in the Senate, said Trump should have trusted the intelligence leaders’ judgment. “I don’t know how many times you can say this but I prefer the president would stay off Twitter - particularly with regard to those important national security issues,” Thune told CNN.

Trump has challenged U.S. intelligence agencies in the past, including casting doubt on their conclusion that Russia interfered in the 2016 U.S. election to help him win the presidency.

The CIA and the Director of National Intelligence office did not comment on Trump’s remarks.

Trump has invested heavily in improving relations with North Korea in hopes of getting Pyongyang to abandon its nuclear ambitions. He broke with decades of U.S. policy when he agreed to meet with North Korean leader Kim Jong Un in June and plans another summit in February.

“North Korea relationship is best it has ever been with U.S. No testing, getting remains, hostages returned. Decent chance of Denuclearization,” Trump said on Twitter.

“I look forward to seeing Kim Jong Un shortly. Progress being made-big difference!”

Director of National Intelligence Dan Coats and CIA Director Gina Haspel told senators that North Korea viewed its nuclear program as vital to its survival and was unlikely to give it up.

Trump also defended his decision to withdraw 2,000 U.S. troops from Syria on grounds that Islamic State no longer poses a threat, saying: “We’ve beaten them.”

“Caliphate will soon be destroyed, unthinkable two years ago,” Trump said on Twitter.

The U.S. intelligence chiefs said Islamic State would continue to pursue attacks from Syria and Iraq against regional and Western adversaries, including the United States.