Election night, I picked up some Chinese food and headed over to watch returns with Cody Keenan, President Obama’s chief speechwriter. It was going to be an early night, we thought, given Hillary Clinton’s lead in the polls. As I walked into his building, I checked my phone to find that Florida appeared to be going for Donald Trump. We sat there for the next few hours as the map showed slowly spreading red. Michigan, Wisconsin, Pennsylvania—states we hadn’t worried about in 2012. That was it. I drank warming beer and occasionally walked into the kitchen to eat lo mein, standing at the counter. For long stretches of time, we said nothing to each other, together in a room, alone with our thoughts.

When Trump was declared the winner, Obama emailed Cody to call him through the switchboard so that we could discuss what he was going to say about this the next day. We called him on a BlackBerry, putting the phone on speaker.

“So, that happened,” Obama said. He sounded surprised but as if he was trying to force himself to be subdued, like a man who just received an unexpected diagnosis and is trying to avoid getting too upset.

“What do you want to say?” Cody asked, laptop out, yet another speech to write.

Obama plowed through a set of boilerplate messages that suddenly seemed radical in contrast to Trump—pay tribute to democracy; congratulate Trump and say nice things about Hillary; pledge an orderly and professional transition. “There should be something at the end for young people,” he said. “Don’t get discouraged. Don’t get cynical.”

I had been largely silent. “Do you want to offer any reassurance to the rest of the world?”

“What do you have in mind?” he asked.

“Something for our allies, for NATO. That the United States will continue to be there for them.”

There was a pause on the other end of the line. “No,” he said. “I don’t think that I’m the one to tell them that.”

I walked home in the early morning darkness, seven blocks, moving slowly as if delaying getting home and going to bed would forestall the world that was to come. The trees were half-empty of leaves and the half-light of the street lamps cast a ghostly light. Obama sent me a brief note reminding me that there are more stars in the sky than grains of sand on the earth. I sent him one back that progress doesn’t move in a straight line. I walked past the apartment on S Street where I’d lived when I was 27 years old. I remembered how I’d planned to move back to New York City. I’d met Ann and stuck it out in my job; we’d moved in together; then I got this job working for Obama.

When I got home, Ann and I talked a bit. “I’m sorry, I don’t know what to say,” she said. “After all the work you guys did…” She let her thought trail off. She was seven months pregnant with our second child, who would be born in an America that I couldn’t yet reconcile.

I slept for three or four hours. When I woke, I had a sensation that I’d known only a few times in my life—the feeling that you don’t want the knowledge you’d gone to sleep with to be true. When someone has died. When something like 9/11 has happened. It was a sense of profound anxiety, a shortness of breath, a constriction in the chest; it was all those things at once—an event that would challenge my assumptions about America and alter the course of the world as well as my own life. After all the work we’d done, it was going to end like this.

I couldn’t shake the feeling that I should have seen it coming. Because when you distilled it, stripped out the racism and misogyny, we’d run against Hillary eight years ago with the same message Trump had used: She’s part of a corrupt establishment that can’t be trusted to bring change. Change we can believe in. How many times had I written those words? Because Trump was a product of the same forces I’d seen aligning against us for 10 years. Because Sarah Palin. The Tea Party. Benghazi. The irrelevance of facts. A healthy majority of Republicans still did not believe that Obama was born in the United States. The Republicans had ridden this tiger, and we’d all ended up inside.

The morning after the election, I went to work, like any other day. I got my PDB, learned about the progress of our counter-ISIL campaign. I ate an egg and sausage burrito. There was still work to do. When I went upstairs for Obama’s morning briefing, the entire communications staff of the White House was gathered in the Oval Office. Obama wanted to speak with us directly. He stood in front of the Resolute Desk and addressed a large semicircle of people, most of whom were younger than I was. I stood, clutching my iPad with the government’s most prized intelligence on it, mine for a couple more months. When I looked at the faces of the assembled group, most were crying.

Obama was smiling, and tried to strike an optimistic note. “The sun is shining,” he joked. Then he thanked us all for our work. “We are leaving this country indisputably better off than we found it eight years ago, and that’s because of you.”

Obama went through stages. That first day, I was in multiple meetings where he tried to lift everyone’s spirits. That evening, he interrupted the senior staff meeting in Chief of Staff Denis McDonough’s office and gave a version of the speech that I’d now heard three times as we all sat there at the table. He was the only one standing. It was both admirable and heartbreaking watching him take everything in stride, working—still—to lift people’s spirits. When he was done, I spoke first. “It says a lot about you,” I said, “that you’ve spent the whole day trying to buck the rest of us up.” People applauded. Obama looked down.

On the Thursday after the election, he had a long, amiable meeting with Trump. It left him somewhat stupefied. Trump had repeatedly steered the conversation back to the size of his rallies, noting that he and Obama could draw big crowds but Hillary couldn’t. He’d expressed openness to Obama’s arguments about healthcare, the Iran deal, immigration. He’d asked for recommendations for staff. He’d praised Obama publicly when the press was there.

Afterward, Obama called a few of us up to the Oval Office to recap. “I’m trying to place him,” he said, “in American history.” He told us Trump had been perfectly cordial, but he’d almost taken pride in not being attached to a firm position on anything.

“He peddles bullshit. That character has always been a part of the American story,” I said.“You can see it right back to some of the characters in Huckleberry Finn.”

Obama chuckled. “Maybe that’s the best we can hope for.”

In breaks between meetings in the coming days, he expressed disbelief that the election had been lost. With unemployment at five percent. With the economy humming. With the Affordable Care Act working. With graduation rates up. With most of our troops back home. But then again, maybe that’s why Trump could win. People would never have voted for him in a crisis.

He kept talking it out, trying on different theories. He chalked it up to multiple car crashes at once. There was the letter from FBI Director James Comey shortly before the election, reopening the investigation into Clinton’s email server. There was the steady release of Podesta emails from Wikileaks through October. There was a rabid right-wing propaganda machine and a mainstream press that gorged on the story of Hillary’s emails, feeding Trump’s narrative of corruption.

He talked about what it took to win the presidency. To win, he told us, you have to have a core reason why you’re running, and you need to make it clear to everyone how much you want to win. “You have to want it,” he said, like Michael Jordan demanding the ball in the final moments of a game.

In a way, he was just like the rest of us—trying out different theories for what had happened, trying to figure out what it meant, what it said about us as a country. But of course he was different. He’d seen the country, and the world, from a different perch. And the one thing he kept coming back to was the expanse of time, the fact that we were just “a blip” in human history. In giving advice on how to deal with Trump, he offered a simple maxim: “Find some high ground, and hunker down.”

On January 19, the last full day of the Obama presidency, I gathered up the items I had to return: multiple laptops that had followed me around the world; a BlackBerry from which I’d sent hundreds of thousands of messages; a diplomatic passport on which I could no longer travel. A group of us walked over to the Executive Office Building, as if it would be easier if we went together, carrying boxes of personal belongings like laid-off workers. After we were done “out-processing,” we came back to the West Wing and a few people went into Cody’s office to have a beer and watch old speeches. Instead, I sat alone in my office—my email account would be deactivated within an hour. So I typed out some last messages. My final note was to Obama. We had this debate, over the years, about whether individuals or social movements shape history—the kind of casual, esoteric conversation that filled in downtime in cars, helicopters, airplanes, or the quiet of the Oval Office. I had been on the side of social movements, dating back to the early days of the Arab Spring. “I was wrong,” I told him in my message. “You’ve made a difference in the lives of billions of people.”

That night, the Obamas hosted a reception for the remaining staff in the White House, a skeleton group of core staff, as most people had had their last days during the previous week. Afterwards, he invited us all up to his private residence, guiding us through the different rooms, a part of the White House I’d been in only a couple of times over the last eight years. He took me over to a frame in the corner of one room. “This is one of five original copies of the Gettysburg Address.” I leaned in and examined Lincoln’s careful handwriting, larger and more legible than Obama’s. The speech barely went onto a third page before it ended with the signature “Abraham Lincoln. November 19, 1863.”

“We could never get them this short,” I said, peering down at the writing.

He laughed. “I used to come in here sometimes in the middle of the night while I was writing. For inspiration.” I thought about him roaming these rooms in the early morning hours, going over some text I’d written, while I was off somewhere staring at a laptop.

We walked out onto the Truman Balcony, which overlooked a darkened South Lawn, the Washington Monument and the Jefferson Memorial in the distance beyond. I thought about something a Secret Service agent had said about the end of the administration—that he’d been relieved to complete two terms with Obama alive. Unspoken were the myriad threats that must have come their way, the pressure of an African American being elected president in a country with its own history of political violence, as Lincoln’s handwriting recalled. Obama, unlike Lincoln, was not going to be frozen in time as a young man taken by tragedy; he’d reached the end of the race, which made him more human in the scope of history. As he’d said when he eulogized Nelson Mandela, he wasn’t a saint, he was a man.

I went back to my office and stayed until five thirty in the morning. I couldn’t seem to get to the end of the paper. I couldn’t take any of it with me; it was now the property of the National Archives, and I had to box up what I might want access to in the years ahead. There was a large, heavy metal safe in the corner where I had set aside paper over the years, documents that I might want to look at later. I sat there, in the middle of the night, looking at photographs of bin Laden’s emptied compound after the raid; early versions of what became the Iran deal; communications from the Vatican on Cuba. I put aside the things that had to be saved for posterity, stored away someplace to be found at a later date.

The morning of the inauguration, the Obamas did a farewell with several hundred former staffers in a hangar at Andrews. While they shook one last set of hands along a rope line, I boarded the plane with a small staff cohort who would accompany them on their flight out to Palm Springs, California, where they’d start their vacation. George W. Bush’s team had recommended we do this to make the flight less lonely for them after eight years when they were surrounded by dozens of people. When I got on board, I noticed that the place cards that usually read “Air Force One” now simply said “aboard the presidential aircraft”—it wasn’t Air Force One since the president wouldn’t be on board.

It had been drizzling, and I watched through dampened windows as the Obamas took one last walk down a long red carpet, through a military honor guard, and up the stairs to the plane. Once on board, Michelle Obama sat, as if feeling the full exhaustion of the last eight years, on the first couch down the hallway of the plane. Obama held her closely, whispering something in her ear.

The mood on the flight was subdued. The Obama girls sat with some family and friends in the staff area. They had been so young; now they were both taller than me. I stood in the hallway of the plane chatting with Obama—for the first time in eight years, I was no longer talking to the president. His face acquired a slight droop when he was tired, and the crevices in his cheeks were deeper and more pronounced than the fresh face, full of confidence, that I’d first looked at in a conference room all those years ago.

“I came to see the presidency like a game of Pac-Man,” he told me, moving his hand as if using a joystick in front of him. “Sometimes I felt like I was just outrunning people, trying to avoid getting tripped up before I got to the end of the board.” He was nestled between two presidents far less qualified than he was, yet he—the only black person to hold the office—had been held to a higher bar, and he’d cleared it.

“And here you are,” I said.

“And here I am.” He laughed. He looked profoundly relieved, though it was jarring to hear him talk about the presidency in the past tense, as a job he once had.

I told him about my first thoughts upon boarding the plane. “I always get on this plane,” I said, “put down a foldout desk, take out my laptop, and start working. But now I’ve got nothing to do. No emails to answer, no speech to write, no crisis to deal with. It’s . . . strange.”

“And I’ve got no briefings to read,” he said. “All the decisions have been made.”

I thought about the weight that was lifted, but also all of the information that must have filled his thoughts for eight years, now unoccupied. What must that be like, to suddenly have all of that mental space, all of that time, now open. “What are you going to do tomorrow morning, with all that extra time?” I asked.

“Sleep in,” he said, before walking back to his family.

This article is adapted from an excerpt of The World as It Is, by Ben Rhodes.