WASHINGTON — In the weeks after he became the Republican nominee on July 19, 2016, Donald Trump was warned that foreign adversaries, including Russia, would probably try to spy on and infiltrate his campaign, according to multiple government officials familiar with the matter.

The warning came in the form of a high-level counterintelligence briefing by senior FBI officials, the officials said. A similar briefing was given to Hillary Clinton, they added. They said the briefings, which are commonly provided to presidential nominees, were designed to educate the candidates and their top aides about potential threats from foreign spies.

The candidates were urged to alert the FBI about any suspicious overtures to their campaigns, the officials said.

The Clinton campaign didn't respond to a request for comment.

The briefings were led by counterintelligence specialists from the FBI, the sources said. They were timed to occur around the period when the candidates began receiving classified intelligence, the officials said, which put them at greater risk for being targeted by foreign spies. Trump's first intelligence briefing as Republican nominee was Aug. 17, 2016, sources told NBC News at the time.

Trump was "briefed and warned" at the session about potential espionage threats from Russia, two former law enforcement officials familiar with the sessions told NBC News. A source close to the White House said their position is that Trump was unaware of the contacts between his campaign and Russians.

"That the Republican and Democrat nominee for president received a standardized briefing on counterintelligence is hardly a news story," said Raj Shah, a White House spokesman. "That NBC News hears about the contents of this classified conversation due to an inappropriate leak is a news story."

It's unclear whether the warning about Russia was passed on to other campaign officials.

Still, the revelation that the Trump campaign was warned about spying threats from Russia and other adversaries, which has not been previously reported, casts a new light on the Trump campaign's dealings with Russians in the months before the November election.

As a former senator and secretary of state, Clinton would have been familiar with counterintelligence briefings, having already held a top-level security clearance. Trump, who was in his first political campaign, may have been hearing some of the information for the first time.

Trump would have been told, "If you see these kinds of contacts please let us know about them so we can keep you updated on the threat picture," said Frank Montoya, a former FBI counterintelligence agent and supervisor who retired in 2016.

The situation was complicated by the fact that the FBI had already become aware of contacts between members of the Trump campaign and Russia, and was beginning to investigate further. Former CIA Director John Brennan has said he told the FBI about a pattern of contacts the CIA observed between members of the Trump team and Russians, and former FBI Director James Comey said the bureau then began investigating in July 2016.

Montoya and other former FBI officials told NBC News the FBI would not have wanted to compromise that investigation by saying too much in the counterintelligence briefing of Trump.

By the time of the warning in late July or August, at least seven Trump campaign officials had been in contact with Russians or people linked to Russia, according to public reports. There is no public evidence that the campaign reported any of that to the FBI.

Republican Presidential candidate Donald Trump, speaks during the final day of the Republican National Convention in Cleveland, Thursday, July 21, 2016. Evan Vucci / AP file

After the FBI warning, the candidate's son, Donald Trump Jr., exchanged Twitter messages in September with Wikileaks, which the U.S. intelligence community publicly accused in October of acting as an agent in Russia's covert operation to interfere in the election.

For example, on Sept. 20, WikiLeaks wrote to Trump Jr. that "a PAC run anti-Trump site putintrump.org is about to launch," according to messages first published by the Atlantic magazine. "The PAC is a recycled pro-Iraq war PAC. We have guessed the password. It is 'putintrump.' See 'About' for who is behind it. Any comments?"

The next morning, the Atlantic reported, Trump Jr. responded to WikiLeaks. "Off the record I don't know who that is, but I'll ask around. Thanks."

Trump Jr.'s lawyer, Alan Futerfas, did not dispute the Atlantic's reporting.

That same month, Attorney General Jeff Sessions, then a senator running the Trump campaign's foreign policy operation, met with Russia's ambassador to the U.S., Sergey Kislyak, in his Senate office -- a meeting he failed to disclose during his confirmation hearing. (Sessions said he routinely met with foreign officials as a member of the Senate Foreign Relations Committee.)

"If I give you a defensive briefing and the illicit behavior continues, I'm not going to just scratch my head over that, especially if I see continued interference," Montoya said. "If we're telling these guys stuff and they are not acting on it, then we're going to keep that as evidence."

Frank Figliuzzi, a former head of FBI counterintelligence and an NBC News analyst, said counterintelligence briefings "provide an opportunity for investigative subjects to be transparent with the bureau and to come back if such contacts are occurring because of admonishments by the bureau."

If they fail to do that, he said, "a couple of factors could be at play: They didn't spread the message to the rest of the team or there is some form of guilty conscience that prohibits them."

The Trump team had contacts with Russians throughout the campaign.

In May 2016, Trump Jr. met at a National Rifle Association dinner with a Russian central banker with ties to Russian President Vladimir Putin who had previously contacted the campaign saying he wanted to pass on a message from the Russian president to Trump.

Also in May, Trump was told by campaign aide George Papadopoulos that he had connections with people who could facilitate a meeting between the candidate and Putin, according to a court filing. Papadopoulos had met with a London-based professor two weeks earlier who claimed to have connections to Russian officials, according to court documents.

In June 2016, Trump Jr. hosted a meeting in Trump Tower with a Russian lawyer with ties to the Kremlin, and a Russian-American lobbyist. Paul Manafort and Jared Kushner also sat in. An email to Trump Jr. setting up the meeting promised incriminating information about Clinton as part of a Russian government effort to help the Trump campaign.

In July 2016, Manafort sent an email offering a private briefing on the Trump campaign to his former business partner, a Russian oligarch with ties to Putin.

Manafort left the campaign Aug. 19, two days after Trump's first intelligence briefing.

It's unclear whether the FBI gave any other counterintelligence warnings to the Trump team before the election.

In September 2017, Senate Judiciary Committee Chairman Chuck Grassley, R-Iowa, asked the FBI whether it ever briefed or warned Trump campaign officials about alleged attempts by the Russian government to infiltrate the campaign.

"The FBI has reportedly given `defensive briefings' during previous presidential campaigns to warn candidates and campaign staff of potential foreign influence and counterintelligence concerns," Grassley's office said in a statement. "Such warnings allow unwitting organizations and individuals to take defensive actions to protect themselves."

After Trump took office, The New York Times reported that the FBI warned Hope Hicks, Trump's communications director, about what they deemed suspicious emails from Russians.

Senior F.B.I. counterintelligence agents met with Hicks in the White House Situation Room at least twice, gave her the names of the Russians who had contacted her, and said that they were not who they claimed to be, The Times reported.

The Times said there is no evidence that Hicks did anything improper, but that intelligence officials became alarmed by introductory emails that she received from Russian government addresses in the weeks after Trump's election.