The Soviet Union theorized that President Lyndon B. Johnson could have been behind JFK’s assassination — and also feared Moscow could be blamed and attacked, according to documents in a major release of files related to Kennedy’s slaying on Thursday.

The Dec. 1, 1966, FBI memo, which relayed unconfirmed speculation, noted that sources said the KGB “was in possession of data purporting to indicate President Johnson was responsible for the assassination of the late President John F. Kennedy.”

The memo, which was forwarded to the White House by FBI Director J. Edgar Hoover with the all-caps title “REACTION OF SOVIET AND COMMUNIST PARTY OFFICIALS TO THE ASSASSINATION OF PRESIDENT JOHN F. KENNEDY,” said:

“KGB headquarters indicated that in view of this information, it was necessary for the Soviet Government to know the existing personal relationship between President Johnson and the Kennedy family, particularly that between President Johnson and Robert and ‘Ted’ Kennedy.”

In the days following JFK’s killing, Moscow believed the slaying could be used by rogue American military leaders to whip up anti-Soviet sentiment and even lead to an attack.

Soviets feared dark US forces were “interested in utilizing the assassination and playing on anticommunist sentiments in the United States,” according to the FBI.

“Our source further stated that Soviet officials were fearful that without leadership, some irresponsible general in the United States might launch a missile attack on the Soviet Union.”

Kennedy’s assassin, Lee Harvey Oswald, lived in the Soviet Union for nearly three years from 1959 to 1962 and married a woman from Minsk.

The release of documents was made to satisfy a 25-year deadline set forward by the Oct. 25, 1992, enactment of the JFK Assassination Records Collection Act.

However, many of the files were held back from release by President Trump after the CIA and FBI asked for more time to redact information that could cause “potentially irreversible harm.”

While Soviets believed JFK’s killing could have been engineered internally, LBJ saw a foreign link to the assassination.

Johnson would regularly say he believed JFK’s murder was payback for CIA involvement in the assassination of South Vietnam’s head of state, documents showed.

LBJ’s CIA director, Richard Helms, said in a deposition that Johnson wasn’t shy in sharing his own JFK conspiracy theories.

“President Johnson used to go around saying that the reason President Kennedy was assassinated was that he had assassinated President Diem,” Helms said during an April 23, 1975, deposition at Langley. He didn’t say whether Johnson ever explained why he thought that.

South Vietnam’s autocratic leader Ngo Dinh Diem was arrested and assassinated in 1963 after a US-backed coup in the country.

Johnson was in JFK’s motorcade on Nov. 22, 1963, in Dallas when Oswald opened fire from the sixth floor of the Texas School Book Depository.

LBJ was sworn into office later that day aboard Air Force One.

Oswald’s ability to squeeze off those shots has long been debated, with critics of the lone-killer theory believing he didn’t have great marksmanship.

But a 1967 FBI cable quoted a Cuban intelligence operative telling another of Oswald’s shooting ability, “Oh, he was quite good.”

When the other asked how he knew, that operative said, “I knew him.”

Oswald was a known supporter of Fidel Castro and was active in the “Fair Play for Cuba Committee,” which sought greater US support for the Havana regime.