The boastful tone aimed to grant Trump a measure of validation and credit at a time of enormous political vulnerability amid an ongoing impeachment proceeding. But it also served to rebut criticism over Trump’s move in 2018 to abandon the Iran nuclear deal that the Obama administration negotiated three years earlier. The decision fulfilled a chief Trump campaign promise but exacerbated tensions between Washington and Tehran and, experts said, helped lead to the escalating crisis punctuated by the drone strike on Soleimani.

Trump, former aides said, has burned with a desire to erase Obama’s foreign policy legacy and prove himself a superior commander in chief.

“For whatever reason, President Trump has fixated on President Obama, and I think that he views President Obama as the metric he has to beat,” said Fernando Cutz, who served on the National Security Council under both presidents, including a stint as senior adviser to H.R. McMaster, Trump’s second national security adviser.