President Barack Obama headed inside the Capitol for the traditional bipartisan luncheon that follows every inauguration when someone handed him a copy of their ticket to the history-making event and asked for his autograph.

“It’s because of you, John,” the first black American president wrote to Rep. John Lewis on Jan. 20, 2009.

Lewis, who died Friday night after a six-month battle with pancreatic cancer, had that kind of moral clout in a Capitol that increasingly lacks a true compass. The words “civil rights icon” became synonymous with Lewis over his nearly 34 years in Congress, always harking back to his days leading marches in the 1960s as a top lieutenant in the Rev. Martin Luther King Jr.’s team.

Lewis harnessed his own history, beaten by state troopers in Selma, Ala., as he and other peaceful protesters tried to march across the Edmund Pettus Bridge, and turned it into a moral calling on Capitol Hill. Every year, he led dozens of members of Congress to a weekend pilgrimage to Selma that served as an educational retreat to learn of the civil rights struggle and culminated with a soul-replenishing trip with Lewis across the bridge where he had nearly died in 1965.

For the 50th anniversary, Lewis marched with then-President Obama on one side of the span while former president George W. Bush marched on the other side.

Five years later, on an early Sunday morning in June, Lewis appeared on 16th Street in Washington just outside the White House. He stood alongside D.C. Mayor Muriel E. Bowser (D), who had just ordered the street to be painted with the words “Black Lives Matter.” They inspected the scene where protesters had been dispersed with tear gas to clear Lafayette Square before President Trump could walk to the historic St. John’s Episcopal Church to stage a photo opportunity, a scene that was all too familiar in Lewis’s youth.

Cancer treatments had left him frail, and he required a cane to get around. A few days earlier, he had told his Democratic colleagues that the image of George Floyd’s death in police custody and the ensuing protests hurt him deeply, because he had thought America had moved past such moments.

“It’s been hard and difficult for me. I’ve cried, I’ve prayed,” Lewis told Democrats on the conference call, according to the notes of a participant.

Lewis was not seen in public again, a missing voice for a moment so suited to his life experience.

“John answered brutal violence with courageous hope. And throughout his career as a civil rights leader and public servant, he worked to make our country a more perfect union,” Bush said in a statement Saturday.

The former president never mentioned Trump, but his final sentence made clear he is more comfortable with Lewis’s tactics than the current president’s.

“America can best honor John’s memory by continuing his journey toward liberty and justice for all,” Bush said.

Obama published an essay Saturday that reminisced about their final private talk in early June, after the lawmaker and former president had held a virtual town hall with young activists. Lewis told Obama how inspiring the group was.

“I told him that all those young people — of every race, from every background and gender and sexual orientation — they were his children. They had learned from his example, even if they didn’t know it,” Obama wrote.

Through his biography and his own charm, Lewis cast the type of long shadow that every president — until Trump — felt comfortable sitting under.

When Ronald Reagan signed the 1988 law banning housing discrimination, he singled out first-term Rep. Lewis for special praise for bringing “us one step closer to realizing Martin Luther King’s dream.’’

Bill Clinton, appearing in a new documentary about Lewis, essentially apologized for the 1994 crime bill that Lewis opposed because of its strict death penalty provisions.

“The older I’ve gotten, the closer I’ve come to his position. And maybe what we need is a little more reconciliation and rebuilding,” Clinton told the filmmakers of “John Lewis: Good Trouble.”

Bush drew a direct line from the Edmund Pettus Bridge to Lyndon B. Johnson signing the first Voting Rights Act in 1965 — a connection he highlighted when he signed a rewrite of the historic law in 2006.

“In a little more than a year after Selma, a newly enfranchised black community used their power at the ballot box to help defeat the sheriff who had sent men with whips and clubs to the Edmund Pettus Bridge on that bloody Sunday,” Bush said then.

In 2011, Obama draped the Presidential Medal of Freedom, the highest civilian honor, around Lewis’s neck.

Despite his reverend-like demeanor, Lewis knew how to play political hardball if it meant advancing his cause.

In 2008, Lewis accused Obama’s opponent, then-Sen. John McCain (R-Ariz.), of running a campaign that was creating a racially charged atmosphere that could lead to violence. A decade later, McCain admitted that he was still bitter that someone he considered a “personal hero” had lodged such a charge.

“I couldn’t believe it, and I couldn’t forgive it. I still can’t,” McCain wrote in “The Restless Wave,” a memoir released three months before his own death from cancer in 2018.

In 1986, Lewis ran against one of his closest friends, Julian Bond, in the Democratic primary for the House seat that Lewis would hold for more than three decades. They had helped run the Student Nonviolent Coordinating Committee in the 1960s, then both settled in Atlanta when they shifted from activism to politics.

Lewis publicly challenged Bond to take a drug test, a racially charged move that Bond believed helped send white voters to Lewis’s side for a narrow victory.

During Obama’s 2008 campaign, Lewis, then in his late 60s, initially rejected Obama and instead endorsed Hillary Clinton, part of a generational divide within the Congressional Black Caucus in which older members doubted that America would elect a young black man president.

For only the second time ever, Lewis drew a primary challenge based on his support of Clinton — and three weeks after Obama defeated her by a more than 2-to-1 margin in Georgia, Lewis switched sides and endorsed the future president. He won his primary that summer with less than 70 percent of the vote.

On Aug. 28, 2008, the night Obama accepted the Democratic presidential nomination, on the 45h anniversary of the March on Washington, which Lewis helped organize, he walked through the Denver stadium trying to find his seat, coming across then-Rep. Jesse L. Jackson Jr. (D-Ill.), who had been an early Obama supporter.

Lewis and the son of the civil rights activist hugged, never saying a word, just weeping, over the history they were about to witness.

“It was a very moving day for him and myself. We didn’t need to speak in a verbal way,” Lewis recalled of that moment in a 2012 interview.

A week before Trump was sworn in, Lewis made clear that he wanted nothing resembling the warm bonds he shared with the first five presidents he served alongside in Congress. He declared Trump not “a legitimate president” because of Russian interference in the 2016 race, and Lewis led a boycott of several dozen Democrats of that inauguration.

Lewis knew when to choose activism and when to use restraint. In 2016, after a massacre at a gay nightclub in Orlando, some rank-and-file Democrats wanted to stage a sit-in to demand House GOP leaders vote on gun violence bills — so they went to Lewis, whose imprimatur turned the idea into a movement.

But in 2019, once the Democrats had reclaimed the House majority, Lewis joined a group of younger House Democrats who marched to the Senate and sat on the back benches in a silent protest over GOP demands for border security funds.

They planned to erupt in protest and yell “shame on you” at Senate Republicans, a move that Lewis realized would only have antagonized their counterparts.

“That’s not how we do this,” Lewis told the younger Democrats, according to Rep. Ayanna Pressley (D-Mass.), who recounted the story for “Good Trouble.”

That documentary, filmed in 2018 and 2019 and released in early July, serves as Lewis’s final words on an extraordinary life.

He grew emotional as he held the official 2009 Obama inaugural program, explaining how he felt when he was declared the winner.

“Oh, I cried, I cried uncontrollably. I jumped so high and started crying. I didn’t think my feet were going to touch the ground. I cried,” Lewis told the filmmakers.

At Obama’s second inauguration, the president found his older friend and let him know how he felt about him.

“It’s still because of you, John,” Obama told Lewis.

Then Lewis looked in the camera and shared his thought about Trump’s presidency.

“Makes me feel like crying again,” Lewis said.