Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Donald Trump traveled to CIA headquarters Saturday to offer reassurance to the workforce after he spent weeks criticizing American intelligence, but his unscripted, self-referential remarks before a wall of stars memorializing fallen officers are drawing criticism, including a pointed denunciation from the agency’s recently departed director.

"Former CIA Director Brennan is deeply saddened and angered at Donald Trump's despicable display of self-aggrandizement in front of CIA's Memorial Wall of Agency heroes,” Nick Shapiro, a former aide to John Brennan at CIA, told NBC News’ Andrea Mitchell.

Brennan, Shapiro said, believes Trump "should be ashamed of himself."

Trump was greeted with cheers by the CIA officers who volunteered to be there to greet him on a Saturday.

But the wall of 117 stars in the CIA lobby is a revered place, and presidents who have spoken there tend to do so carefully and with a close attention to their subject — usually the sacrifices of the CIA officers and their families.

Trump expressed support for the CIA, but he also veered into political territory, denouncing the news media, boasting about the size of his inaugural crowds, and even discussing his own appraisal of his intellect.

"And then they say, 'Is Donald Trump an intellectual?'" Trump said. "Trust me, I’m like a smart person."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

A former senior CIA officer told NBC News he was embarrassed watching the remarks, which he called a "free-wheeling, narcissistic diatribe."

President Donald J. Trump speaks at the CIA headquarters, in Langley, Virginia, on Jan. 21, 2017. Olivier Douliery / POOL / EPA

Another former senior official noted that that early on in his remarks Trump interrupted himself as he was commenting on the stars behind him and never returned to the topic.

"Not quite a `this hallowed ground moment,'" the official said.

"The wall behind me is very, very special," Trump said during his remarks.

Former CIA Director Mike Hayden, a Republican who opposed Trump, said in an email, "I was heartened that the President gave a speech at CIA. It would have been even better if more of it had been about CIA."

In contrast to Trump, who uttered one sentence about the wall and didn't mention the fallen CIA officers represented there, Vice President Pence made a point of paying homage.

"It's especially humbling for me to be before all of you today — men and women of character, who have sacrificed greatly — and to stand before this hallowed wall, this memorial wall, where we remember 117 who paid the ultimate sacrifice for our freedom," Pence said, before Trump spoke.

When Barack Obama first visited CIA as president in 2009, he read a speech in which he honored CIA officers and told them he would need their help.

On Saturday Trump tried to make a joke about how he would "back" the CIA.

"And I know maybe sometimes you haven't gotten the backing that you've wanted, and you're going to get so much backing. Maybe you're going to say, 'Please don’t give us so much backing,'" Trump said.

To a gathering of career intelligence professionals, he said, "Probably almost everybody in this room voted for me, but I will not ask you to raise your hands if you did."

Had a great meeting at CIA Headquarters yesterday, packed house, paid great respect to Wall, long standing ovations, amazing people. WIN! — Donald J. Trump (@realDonaldTrump) January 22, 2017

In reference to counter terrorism and the campaign against ISIS, he said, “We've been fighting these wars for longer than any wars we've ever fought. We have not used the real abilities that we have. We've been restrained.”

Another former CIA officer who supports Trump said the visit was a success.

"This is the part that the media doesn’t get — this is not like any other president," the officer said. "The critics hate this president so much they cannot get past it. The truth of the visit was in the face to face meetings — people were happy to talk to him. That assuaged a lot of concerns and a lot of anxiety."

Trump later insisted that the meeting had been "great", tweeting early Sunday that he had "paid great respect to [the] wall."

"WIN!" he added.