At a refueling stop in Cape Verde on his way home from an exhausting visit across Africa, Secretary of State Rex W. Tillerson walked through howling winds late Monday night toward the airport’s V.I.P. terminal, where he pulled up a chair and started telling jokes to the reporters who had traveled with him.
He was fired by executive tweet just hours later.
By the time Mr. Tillerson again spoke to reporters, on Tuesday afternoon in Washington, the man who had strode confidently and relaxed throughout the weeklong diplomatic trip was replaced by a humbled and emotional one who nearly choked up as he announced that he would be handing off his powers at the stroke of midnight.
Some senior administration officials said Mr. Tillerson — who in nearly 14 months at the State Department had departed from President Trump’s policies on the Paris climate accord, the Iran nuclear deal and diplomacy with North Korea — should have seen it coming.
Officials said John F. Kelly, the president’s chief of staff, urged Mr. Tillerson late last week to cut short his trip, warning vaguely that he should be on the lookout for an unspecified Twitter post. But State Department officials insisted that had Mr. Kelly intended to relay an ominous message, Mr. Tillerson did not receive it.
That Mr. Tillerson missed such an important signal coming from the White House was emblematic of a tenure punctuated by inopportune comments, bureaucratic inertia and frequent and public disagreements with Mr. Trump.
Indeed, Mr. Tillerson was often uncomfortable navigating the choppy and turgid waters of the Washington political scene. His favorite part of the job was meeting foreign leaders, as he did last week in what was intended to be a good-will tour to mend fences after Mr. Trump’s vulgar justification in January for trying to block some Africans from immigrating to the United States.
His first stop on the five-nation trip was Addis Ababa, Ethiopia, to visit the headquarters of the African Union. At a news conference, Mr. Tillerson was confronted by local reporters about Mr. Trump’s coarse description of African countries. Gamely, Mr. Tillerson parried the questions — just as he had done this year in Latin America and Europe, where his reception had been similarly frosty.
He seemed far more comfortable a few hours later, at a coffee ceremony on the grounds of the American Embassy. At times distant and intensely shy, Mr. Tillerson could often also be quite gracious, and took obvious delight when a colorfully dressed Ethiopian woman sat over a small fire and roasted coffee beans, flowers strewn about her. He gladly accepted a small white china cup filled with black liquid and drank it back.
A turning point came several hours later. In a phone call around 2:30 a.m., he first learned that Mr. Trump had agreed to negotiate directly with Kim Jong-un, the North Korean leader — a diplomatic warming that Mr. Tillerson had offered in September to undertake, only to be publicly rebuffed by the president. The reversal began an important part of the trip for Mr. Tillerson: gaming out how such a meeting could be brought off successfully.
In repeated conversations throughout Africa with aides and reporters, Mr. Tillerson said his years as chief executive of Exxon Mobil taught him valuable lessons about how to handle such delicate conversations. His comments made clear that he expected to be deeply involved, for weeks if not months, in negotiations over how the talks with Mr. Kim would proceed.
From Ethiopia, Mr. Tillerson flew to Djibouti and then Kenya, where he seemed in obvious physical distress during a news conference in Nairobi with Monica Juma, the country’s cabinet secretary for foreign affairs. His aides later said that Mr. Tillerson was suffering from food poisoning after eating a piece of salmon in Ethiopia, and few on his staff were surprised when he canceled a planned trip to an H.I.V./AIDS clinic.
But he rallied the next day, on Sunday, to visit a Nairobi park that serves as a memorial to the more than 200 victims who were killed in a truck bombing against the American Embassy in Kenya on Aug. 7, 1998.
Fighting terror and protecting the physical safety of State Department employees were among the most consistent themes that Mr. Tillerson struck throughout his time as secretary, and the service in Nairobi allowed him to speak about both in the kind of somber tones that he favored.
“As all of you well know, in 1998, terrorists thought they could demoralize and destroy the Kenyan and American people by attacking the U.S. Embassy here in Nairobi,” Mr. Tillerson said. “Of course, they were wrong. Nearly 20 years later, we meet here to honor those who we lost and those who were injured.”
He also seemed to delight in animals and the natural world, and soon after his remarks, Mr. Tillerson headed to Nairobi National Park. A quick tour of a lab was followed by a private safari, the sort of fun that he had increasingly tried to inject into his travel schedule.
But with Washington roiled by news of the impending meeting between Mr. Trump and Mr. Kim, Mr. Tillerson decided on Monday to compress his visits to Chad and Nigeria into one long day, then return home.
In a rare interview with reporters aboard his government plane as it flew west into the sunset, Mr. Tillerson was intent on impressing just how important such meetings with world leaders are.
“This is what diplomacy looks like, O.K.?” Mr. Tillerson said.
The plane landed before dawn on Tuesday at an Air Force base outside the capital. Just a few hours later, he was unceremoniously ousted by Mr. Trump in a Twitter post that showed little patience for the kind of diplomacy or détente that Mr. Tillerson had preached.