WASHINGTON — Two weeks before his inauguration, Donald Trump was shown highly classified intelligence indicating that President Vladimir Putin of Russia had personally ordered complex cyberattacks to sway the 2016 election.

The evidence included texts and emails from Russian military officers and information gleaned from a top-secret source close to Putin, who had described to the CIA how the Kremlin decided to execute its campaign of hacking and disinformation.

Trump sounded grudgingly convinced, according to several people who attended the intelligence briefing. But ever since, Trump has tried to cloud the very clear findings that he received on Jan. 6, 2017, which his own intelligence leaders have unanimously endorsed.

The shifting narrative underscores the degree to which Trump regularly picks and chooses intelligence to suit his political purposes. That has never been more clear than this week.

On Monday, standing next to the Russian president in Helsinki, Trump said he accepted Putin’s denial of Russian election intrusions. By Tuesday, faced with a bipartisan political outcry, Trump sought to walk back his words and sided with his intelligence agencies.

On Wednesday, when a reporter asked, “Is Russia still targeting the U.S.?” Trump shot back, “No” — directly contradicting statements made only days earlier by his director of national intelligence, Dan Coats, who was sitting a few chairs away in the Cabinet Room. (The White House later said he was responding to a different question.)

Hours later, in a CBS News interview, Trump seemed to reverse course again. He blamed Putin personally, but only indirectly, for the election interference by Russia, “because he’s in charge of the country.”

In the run-up to this week’s ducking and weaving, Trump has done all he can to suggest other possible explanations for the hacks into the U.S. political system. His fear, according to one of his closest aides who spoke on the condition of anonymity, is that any admission of even an unsuccessful Russian attempt to influence the 2016 vote raises questions about the legitimacy of his presidency.

The Jan. 6, 2017, meeting, held at Trump Tower, was a prime example. He was briefed that day by John O. Brennan, the CIA director; James R. Clapper Jr., the director of national intelligence; and Adm. Michael S. Rogers, the director of the National Security Agency and the commander of U.S. Cyber Command.

The FBI director, James B. Comey, was also there; after the formal briefing, he privately told Trump about the “Steele dossier.” That report, by a former British intelligence officer, included uncorroborated salacious stories of Trump’s activities during a visit to Moscow, which he denied.

According to nearly a dozen people who either attended the meeting with the president-elect or were later briefed on it, the four primary intelligence officials described the streams of intelligence that convinced them of Putin’s role in the election interference.

They included stolen emails from the Democratic National Committee that had been seen in Russian military intelligence networks by the British, Dutch and American intelligence services. Officers of the Russian intelligence agency formerly known as the GRU had plotted with groups like WikiLeaks on how to release the email stash.

And ultimately, several human sources had confirmed Putin’s own role.

That included one particularly valuable source, who was considered so sensitive that Brennan had declined to refer to it in any way in the Presidential Daily Brief during the final months of the Obama administration, as the Russia investigation intensified.

Instead, to keep the information from being shared widely, Brennan sent reports from the source to Obama and a small group of top national security aides in a separate, white envelope to assure its security.

Trump and his aides were also given other reasons during the briefing to believe that Russia was behind the DNC hacks.

The same Russian groups had been involved in attacks on the State Department and White House unclassified email systems in 2014 and 2015, and in an attack on the Joint Chiefs of Staff. They had aggressively fought the NSA against being ejected from the White House system, engaging in what the deputy director of the agency later called “hand-to-hand combat” to dig in.

The pattern of the DNC hacks, and the theft of emails from John D. Podesta, Hillary Clinton’s campaign chairman, fit the same pattern.

After the briefings, Trump issued a statement later that day that sought to spread the blame for meddling. He said “Russia, China and other countries, outside groups and countries” were launching cyberattacks against U.S. government, businesses and political organizations — including the DNC.

Still, Trump said in his statement, “there was absolutely no effect on the outcome of the election.”

Brennan later told Congress that he had no doubt where the attacks were coming from.

“I was convinced in the summer that the Russians were trying to interfere in the election,” he said in testimony in May 2017. “And they were very aggressive.”

For Trump, the messengers were as much a part of the problem as the message they delivered. Brennan and Clapper were both Obama administration appointees who left the government the day Trump was inaugurated. The new president soon took to portraying them as political hacks who had warped the intelligence to provide Democrats with an excuse for Clinton’s loss in the election.

Comey fared little better. He was fired in May 2017 after refusing to pledge his loyalty to Trump and pushing forward on the federal investigation into whether the Trump campaign had cooperated with Russia’s election interference.

Only Rogers, who retired this past May, was extended in office by Trump. (He, too, told Congress that he thought the evidence of Russian interference was incontrovertible.)

And the evidence suggests Russia continues to be very aggressive in its interference.

In March, the Department of Homeland Security declared that Russia was targeting the American electric power grid, continuing to riddle it with malware that could be used to manipulate or shut down critical control systems. Intelligence officials have described it to Congress as a chief threat to U.S. security.

Just last week, Coats said that current hacking threats were “blinking red” and called Russia the “most aggressive foreign actor, no question.”

“And they continue their efforts to undermine our democracy,” he said.

Almost as soon as he took office, Trump began casting doubts on the intelligence on Russia’s election interference, though never taking issue with its specifics.

He dismissed it broadly as a fabrication by Democrats and part of a “witch hunt” against him. He raised unrelated issues, including the state of investigations into Clinton’s home computer server, to distract attention from the central question of Russia’s role — and who, if anyone, in Trump’s immediate orbit may have worked with them.

In July 2017, just after meeting Putin for the first time, Trump told a New York Times reporter that the Russian president had made a persuasive case that Moscow’s skills were so good that the government’s hackers would never have been caught. Therefore, Trump recounted from his conversation with Putin, Russia must not have been responsible.

Since then, Trump has routinely disparaged the intelligence about the Russian election interference. Under public pressure — as he was after his statements in Helsinki on Monday — he has periodically retreated. But even then, he has expressed confidence in his intelligence briefers, not in the content of their findings.

That is what happened again this week, twice.

Trump’s statement in Helsinki led Coats to reaffirm, in a statement he deliberately did not get cleared at the White House, that U.S. intelligence agencies had no doubt that Russia was behind the 2016 hack.

That contributed to Trump’s decision on Tuesday to say that he had misspoken one word, and that he did believe Russia had interfered — although he also veered off script to declare: “Could be other people also. A lot of people out there.”