"I am pleased to announce that I will name Robert C. O'Brien, currently serving as the very successful Special Presidential Envoy for Hostage Affairs at the State Department, as our new National Security Advisor. I have worked long & hard with Robert. He will do a great job!" Trump tweeted.

The announcement came a week after Trump fired John Bolton, citing disagreements on several issues, and as he confronts a major foreign policy crisis following the attack on Saudi oil facilities -- which the administration has blamed on Iran.

Aides expected an announcement because acting national security adviser Charlie Kupperman, who took over in Bolton's absence, was not scheduled to travel to New York for next week's meeting of the United Nations General Assembly.

Trump personally dispatched O'Brien to help free US rapper A$AP Rocky from Swedish prison earlier this year.

Introducing O'Brien to reporters on the tarmac of Los Angeles International Airport, Trump hailed his "tremendous track record" securing the release of hostages and said "we know each other well," adding "Robert's been fantastic" as a hostage negotiator and that the US hasn't spent any money to secure the hostages' release.

O'Brien also complimented Trump in brief remarks while standing alongside the President.

"It's a privilege to serve with the President. We look forward to another year and a half of peace through strength," he said. "We've had tremendous foreign policy successes under President Trump's leadership. I expect those to continue."

A penchant for flattery

The hostage negotiator interviewed for the post with the President and acting chief of staff Mick Mulvaney last week and enjoyed support from Secretary of State Mike Pompeo, who is now the most influential national security voice in the administration.

Trump, who is known to respond well to flattery, has recounted praise from O'Brien in tweets and in conversations, suggesting that the new national security adviser also knows how to handle the President and his mercurial moods.

O'Brien has also made Trump look good -- giving him numbers to boast about and successes that made for high profile media coverage.

Speaking to reporters aboard Air Force One on Tuesday, Trump again highlighted O'Brien's praise of him in securing the release of hostages.

"Robert O'Brien said, 'Trump is the greatest hostage negotiator in history.' He happens to be right," Trump said, according to pool reporters. "We are 38-0. 38-0, ask Robert. In fact, I had never heard the term. Robert O'Brien said Donald Trump is the greatest hostage negotiator of all time. 38-0. At the time he said it we were 29-0. We are 38-0."

CNN has contacted the State Department for further details on the numbers cited by Trump.

During an Oval Office meeting in March, O'Brien celebrated Trump for his success returning American hostages.

"This wouldn't happen with all of these hostages and detainees without the support of the President," he said. "The President has had unparalleled success in bringing Americans home without paying concessions."

Trump 'wants a consensus builder'

One senior White House official argued the pick shows that Trump "wants a consensus builder, not a showboater" in the role, suggesting O'Brien will cut a lower profile and work better with others in the administration than John Bolton did.

O'Brien, though, has far less national security or foreign policy experience than past national security advisers — under Trump or otherwise. CNN previously reported that the national security adviser role was expected to be diminished in the wake of Bolton's departure as Trump increasingly relies on his own instincts.

Republican Sen. Mitt Romney congratulated O'Brien, who served as an adviser on Romney's presidential campaign in 2012, in a tweet Tuesday.

"Congratulations to my friend Robert O'Brien, who the President has appointed to serve as National Security Advisor. As the Special Presidential Envoy for Hostage Affairs, he has doggedly pursued the release of American hostages abroad. He is a man of the highest integrity," he wrote.

Trump was considering a number of other candidates for the post, and yesterday named five people under consideration: O'Brien, Ricky Waddell, Fred Fleitz, Keith Kellogg, and Lisa Gordon-Hagerty.

Other officials believed to be under consideration included the US special envoy for Iran, Brian Hook, who is close to Trump's senior adviser and son-in-law, Jared Kushner, but who was criticized as a "Never Trumper" by other advisers. Trump had also been considering Rob Blair, a national security aide to Mulvaney, who is nonetheless considered a long shot inside the West Wing.

Trump has solicited recommendations on the selection from advisers and friends, but officials said he would likely rely principally on advice from Pompeo. Trump said last week that he'd asked his chief diplomat if he was interested in also taking on the national security adviser job but that he had declined.

Trump has picked O'Brien at a time when he is confronting another yet another foreign policy crisis following the attack on Saudi oil fields -- a situation that lays bare his dueling instincts in the region, inclinations that ended Bolton's tenure and are bound to complicate his replacement's.

In mulling his response options, Trump finds himself drawn in opposing directions. While he has long sought to appear strong on Iran, he has promised voters he won't be drawn into another Middle East war and says he's open to talking.

CNN previously reported that in his interviews and in interactions over the past days, Trump has sought to gauge whether those vying for the national security post agree with his overarching view that the United States should limit its activities abroad, according to people familiar with the matter.