The classified information that President Donald Trump shared last week with Russian officials had been gathered by Israeli intelligence, according to U.S. officials familiar with the matter, a disclosure that could have far-reaching consequences for U.S. national security.

The intelligence—concerning terrorist threats against airliners—was meant for U.S. eyes only and was provided as part of a longstanding sharing agreement that is predicated on mutual assurances of secrecy, these people said.

Mr. Trump defended on Tuesday his decision to share the information with the Russians, writing on Twitter that he had the “absolute right” to discuss threats with visiting dignitaries. H.R. McMaster, the president’s national security adviser, described the president’s disclosures as “wholly appropriate.”

The fallout left lawmakers on both sides of the aisle rattled, as Mr. Trump prepared to make his first foreign trip as president later this week.

The president’s decision to discuss sensitive intelligence with a U.S. adversary reignited concerns among lawmakers that Mr. Trump is either incapable or unwilling to handle discreetly the nation’s most guarded secrets. He also fanned tensions with U.S. intelligence agencies that date back to before the start of his presidency.

If other countries now shy away from sharing information with the U.S. in the future because they fear Mr. Trump won’t keep the intelligence under wraps, their decision could impede a range of operations from counterterrorism to combating weapons proliferation that depend on intelligence from foreign governments, officials said.

One isolated incident, though, isn’t likely to cause long-term problems because “other countries need U.S. intelligence cooperation more than the other way round,” said Sir Adam Thomson, a former United Kingdom ambassador to North Atlantic Treaty Organization and head of the European Leadership Network think tank.

“But if it looked like it was becoming a pattern by President Trump, then that would indeed have a chilling effect on many countries’ intelligence cooperation with the U.S.” Mr. Thomson said.

One U.S. official who works on counterterrorism operations said that the president seemed “utterly unaware” of the nature of intelligence operations and indifferent to the restrictions that officials place on information that is hard-won and intended for a small circle.

National Security Adviser Lt. Gen. H.R. McMaster said on Tuesday that counterterrorism information that President Trump shared in a meeting with Russians in the Oval Office last week "was wholly appropriate," following reports that the president had revealed sensitive information. Photo: Reuters

The Israeli source was considered so sensitive that the U.S. hadn’t shared it with its closest allies in the so-called Five Eyes group, which includes the U.K. and Canada, the officials said. It came from a source, which is still unidentified, that Israel had developed before Mr. Trump was elected.

One former official who maintains close ties to the White House described a scene in which demoralized security officials have been racing to address one controversy after another. The conversation with the Russians in the Oval Office, while not likely to damage current operations, embarrasses the U.S. among its closest allies, the former official said.

What Mr. Trump discussed with the Russians wasn’t likely a surprise to them, given that news reports have described ambitions held by Islamic State and al Qaeda to attack airliners with concealed explosives. The U.S. is considering expanding a ban on certain electronic devices on airplanes.

Israeli officials didn’t confirm that they were the source of information. And Ron Dermer, the Israeli ambassador to the U.S., played down any potential damage to the relationship.

President Trump speaks to the media in the Roosevelt Room of the White House after meeting with Turkey's President Recep Tayyip Erdogan on Tuesday. Photo: kevin lamarque/Reuters

“Israel has full confidence in our intelligence-sharing relationship with the United States and looks forward to deepening that relationship in the years ahead under President Trump,” Mr. Dermer said in a statement.

But experts said the episode likely upset Israel’s intelligence sector.

“The Israeli government, especially days before a presidential visit, has no choice but try to down play the damage that’s done by this leak,” said Daniel Shapiro, a former U.S. ambassador to Israel. But for Israeli intelligence officials “if information is revealed to an unfriendly country like Russia, they take this very seriously.”

Mr. McMaster and others at the White House sought to dispel the notion that Mr. Trump had jeopardized national security interests. Officials there are convinced that members of intelligence community are deliberately leaking information to undermine and embarrass Mr. Trump.

On Tuesday, the White House provided more details about how Mr. Trump’s comments came to light. After a report on the meeting with the Russian officials was entered into an internal system, an aide pointed out part of the discussion related to aviation threats, officials said.

Tom Bossert, Mr. Trump’s homeland security and counterterrorism adviser, who wasn’t in the meeting, saw the report after staff drew his attention to the president's remarks. Mr. Bossert was alarmed and made the decision to call the National Security Agency and the Central Intelligence Agency to ask how the meeting report should be classified, based on what Mr. Trump had said in the meeting, a senior U.S. official said.

White House officials said the president didn’t inappropriately share intelligence from an ally. They said Mr. Trump spoke about threats to civil aviation coming from Islamic State, noting that Russia had a common interest with the U.S. in preventing such threats.

Mr. McMaster said Mr. Trump emphasized “common interests” between the U.S. and Russia, citing Islamic State’s downing of a Russian jetliner in 2015.

White House reassurances haven’t placated some Republicans and Democrats, who said they’re concerned the president’s actions could have a chilling effect on intelligence sharing.

“If there was disclosure of sensitive information from a traditional partner, other countries will watch that, and they may adjust their behavior accordingly,” said Rep. Mac Thornberry (R., Texas), chairman of the House Armed Services Committee.

Rep. Adam Schiff of California, the ranking Democrat on the House Intelligence Committee, said mistrust from an allied intelligence country can have very serious repercussions for U.S. security.

“If the source is a sister intelligence agency of a friendly country, that country could decide it can’t trust the United States with information, or worse, that it can’t trust the president of the United States with information,” he said.

The State Department faced repercussions from allies over its indiscretion with information in 2010, when WikiLeaks published hundreds of thousands of U.S. diplomatic cables, many of them containing sensitive information that foreign officials or intelligence sources had passed along to U.S. envoys abroad.

But the concerns from foreign countries that were exposed in the leaks were related to the security of U.S. databases, not the ability of the commander-in-chief to keep secrets.

—Julian E. Barnes

and Alan Cullison contributed to this article.

Write to Shane Harris at shane.harris@wsj.com, Carol E. Lee at carol.lee@wsj.com and Paul Sonne at paul.sonne@wsj.com