Former CIA director John Brennan leaves a Senate Intelligence Committee hearing. (Joshua Roberts/Reuters)

Just hours before his planned attendance at the swearing in of a new CIA director, President Trump went on Twitter on Monday to castigate a former leader of the agency, posting that John Brennan “has disgraced the Country.”

In a series of three tweets, the president quoted Dan Bongino, a former U.S. Secret Service agent and frequent Fox News commentator, who earlier Monday morning accused Brennan of being “largely responsible for the destruction of America’s faith in the Intelligence Community,” according to Trump’s tweets.

The tweets came about two hours before he left the White House en route to CIA headquarters in Langley, Va., where Gina Haspel was installed as the next CIA director on Monday morning.

Brennan, who led the agency from 2013 to 2017 under President Barack Obama, has been highly critical of Trump in recent months.

On Sunday, he wrote on Twitter that Trump was on a “disastrous path” and that Republican congressional leaders would bear responsibility for the “harm done to our democracy” if they did not intervene.

Brennan’s comments were prompted by Trump’s tweet on Sunday in which he demanded that the Department of Justice investigate whether the FBI infiltrated or surveilled his 2016 campaign for political purposes.

“You do a great disservice to our Nation & the Republican Party if you continue to enable Mr. Trump’s self-serving actions,” Brennan wrote in a tweet addressed at House Speaker Paul D. Ryan (R-Wis.) and Senate Majority Leader Mitch McConnell (R-Ky.).

Appearing Monday on “Fox & Friends,” Bongino said Brennan was behind the investigation into possible collusion between the Trump campaign and Russia, which he called a “debacle” and a “political hit job.” Bongino also said that Brennan had “disgraced himself.”

Trump’s tweets quoted Bongino’s comments at length from his appearance on the Fox News show.

Trump’s first trip to CIA headquarters — on his first day in office in 2017 — was also mired in controversy.

During an appearance billed as a chance to express his gratitude for the intelligence community, he delivered a campaign-style, stream-of-consciousness airing of grievances.

Trump took aim at the Senate for delaying confirmation of his nominees; at critics for questioning whether he is smart and vigorous; and at journalists, whom he called “the most dishonest human beings on Earth” and accused of lying about the size of his inauguration crowd.

The Senate voted Thursday to confirm Haspel’s nomination, 54 to 45, despite lingering concerns about the role she played in the brutal interrogation of suspected terrorists captured after the Sept. 11, 2001, attacks. Haspel is the first woman to lead the CIA.

She succeeds Mike Pompeo, whom Trump nominated as secretary of state.