Official Washington gathered on Saturday for a funeral to honor one of its favorite sons, John Sidney McCain III. It delivered for the country and the world an extraordinary, and in moments disquieting, repudiation of Donald Trump’s presidency and today’s politics.

Ringing through Washington National Cathedral on a dreary morning were paeans to bipartisanship, compromise and civility of the sort that seem to be under daily assault from all corners of the country, especially from the White House.

The Republican senator’s mourners, though sometimes angry, were also wistful and worried that what has been bludgeoned by the country’s divisions and the current president might never return. A common decency. A shared identity and values that transcend ideology, class or race. A toughness that shows itself in battle and service to nation rather than on Twitter. Each of these was touted as a key element of McCain’s epic life.

The full tableau of his funeral — which included the previous three presidents and every major-party nominee for the past two decades — also served as a melancholy last hurrah for the sort of global leadership that the nation once took for granted.

Trump was absent and his name never invoked, but the entire service was animated by a sustained rebellion against the president’s worldview and his singular brand of politics.

The most stinging and personal rebuke came from McCain’s distraught daughter, Meghan, who dispensed with diplomatic niceties and coded language to condemn the sitting president in a style as direct and raw as her father’s.

“We gather here to mourn the passing of American greatness,” she said, gritting her teeth through the tears. “The real thing, not cheap rhetoric from men who will never come near the sacrifice he gave so willingly, nor the opportunistic appropriation of those who lived lives of comfort and privilege while he suffered and served.”

When she fiercely declared that “the America of John McCain has no need to be made great again because America was always great,” the generals, senators, former presidents and other world leaders who filled the pews burst into applause.

At virtually the same moment, Trump, who had spent the morning tweeting his grievances into a void, donned a white “Make America Great Again” cap and traveled in a presidential motorcade to his Virginia golf course.

His move was unsurprising: Trump, from the moment he launched his campaign for the White House, has spoken of McCain as though the senator was a personal enemy. McCain returned the sentiment by making clear that the president was not welcome at his funeral.

Big Washington funerals are as much about the country and its politics as they are the person who is being remembered. On Saturday, speaker after speaker used McCain’s life story — son of an admiral, hero of a lost war, long-serving senator and statesman — and the values that shaped his life to point up the shortcomings of Trump and the divisive, angry politics of the moment.

Two presidents, who each defeated McCain in bitter campaigns, used McCain’s funeral as a moment to speak bluntly of their fears for the country and the state of American democracy.

“If we are ever tempted to forget who we are, to grow weary of our cause, John’s voice will always come as a whisper over our shoulder: ‘We are better than this. America is better than this,’ ” former president George W. Bush said.

Former president Barack Obama spoke after Bush and delivered an even starker warning to the mourners and the country.

“So much of our politics, our public life, our public discourse can seem small and mean and petty, trafficking in bombast and insult and phony controversies and manufactured outrage,” Obama said. “It’s a politics that pretends to be brave and tough, but in fact is born of fear. John called on us to be bigger than that. He called on us to be better than that.”

The funeral served as a robust and united defense of the Washington institutions that have been a cornerstone of American democracy and that Trump has sought to undermine. Sitting in the pews were the stewards of those institutions — the CIA, the Justice Department and the news media, among others — that Trump regularly attacks.

One defense came from an unlikely champion: Henry Kissinger, who served a president, Richard Nixon, who was forced from office for politicizing the federal government and betraying his oath to the nation.

“Like most people of my age, I feel a longing for what is lost and cannot be restored,” said the former secretary of state, who is 95. “Our country’s honor is ours to save.”

Kissinger praised McCain’s “ebullience” and “instinctive sense of moral duty,” and spoke of the gift that his passing had afforded the nation.

“John has bestowed on us a much needed moment of unity and a renewed faith in the possibility of America,” he said.

Kissinger’s declaration seemed more like a wish from an old man than an affirmation of what would come to pass. As Kissinger was speaking, Trump, en route to the golf course, was tweeting a threat to terminate the North American Free Trade Agreement.

Earlier in the morning, as McCain’s funeral cortege made its way from the Vietnam Veterans Memorial to the cathedral, Trump tweeted that he had been wronged by the court system, attacked the “Fake Dossier” that he insists the Russia investigation is based on, and misspelled Obama’s first name.

He also relied on a surrogate to attack his adversary. In an unmistakable swipe at McCain, who mounted two unsuccessful campaigns for the presidency, longtime Trump spokeswoman Katrina Pierson tweeted: “@realDonaldTrump ran for @POTUS ONE time and WON! Some people will never recover from that. #SorryNotSorry Yes, #MAGA.”

But apart from that, Trump seemed isolated, the mourners in the cathedral a lopsided counterpoint.

On this Saturday morning, Hillary Clinton sat shoulder to shoulder with former vice president Richard B. Cheney, whom she routinely lambasted when she served with McCain in the Senate. Bush laughed with and playfully snuck candies to Michelle Obama.

There as well, and listening impassively to the criticisms of the man they serve, were several members of Trump’s administration, including Chief of Staff John F. Kelly and Defense Secretary Jim Mattis — both former Marine Corps generals who share McCain’s ethic of selfless service. Also in attendance were Trump’s national security adviser, John Bolton, two of his most prominent ambassadors, and his daughter Ivanka Trump and son-in-law Jared Kushner.

McCain also invited several of Trump’s possible Democratic challengers in 2020 — former vice president Joe Biden, Sen. Elizabeth Warren (D-Mass.) and others with whom he served in the Senate.

Much of the praise for McCain focused on his vision of the United States as a global superpower and moral beacon, positions Trump has been accused of abandoning. His longtime friend, former senator Joseph I. Lieberman, lauded McCain’s globe-trotting ways and his advocacy on behalf of political prisoners and dissidents in far-flung places such as Myanmar and Syria.

“The name John McCain was a source of hope and inspiration for oppressed people around the world,” Lieberman said.

Yet more than ever before in the post-World War II era, McCain’s vision of the United States as the bulwark against tyrants, guarantor of global stability and refuge for the oppressed is out of favor.

It fell to Bush and Obama, both imperfect advocates, to defend McCain’s view of the U.S. obligation to promote freedom. McCain championed an American exceptionalism that contrasts with Trump’s routine praise for some of the world’s most brutal dictators.

“John detested the abuse of power,” Bush said. “He could not abide bigots and swaggering despots. There was something inside of him that made him stand up for the little guy. To speak for forgotten people and forgotten places.”

Long before Trump seized his “America First” mantle, McCain lamented the nation’s gradual withdrawal from the world stage and regularly blasted Obama for his “total lack of leadership” and reluctance to use military force. Obama was reacting to the excesses and imperial overreach of the Bush presidency, which produced two of the longest and costliest wars in U.S. history.

In his eulogy, Obama mentioned McCain’s frequently stinging critiques. “While John and I disagreed on all kinds of foreign policy issues, we stood together on America’s role as the one indispensable nation,” Obama said.

“We never doubted we were on the same team,” he added.

Before he died of brain cancer at age 81, McCain had spent months selecting the speakers, guests, readings and songs to tell his story and give life to a vision of the country that he perceived as under assault.

The last time Washington held a funeral of this magnitude was in January 2007, when many of the same figures gathered to say goodbye to former president Gerald R. Ford.

Speakers praised Ford for calming a nation at war with itself after the Watergate scandal, the divisive Vietnam War and Nixon’s impeachment. “Gerald Ford gave us back our government,” historian Richard Norton Smith noted in his eulogy.

On Saturday, no one was hailing McCain as America’s savior. Instead, they seemed to be mourning a man whose life epitomized so much of what had been lost.

“You were an exception,” Meghan McCain told rapt mourners. “You gave us an ideal to strive for.”

That ideal seemed impossibly distant.