John McCain buried next to his best friend where his decades of public service began Sen. John McCain was buried Sunday at the U.S. Naval Academy Cemetery.

Five days of national mourning for Sen. John McCain came to a close Sunday afternoon on a sloping green hillside overlooking Maryland's Severn River and near the hallowed halls where the Arizona politician's life of public service began as a plebe -- the U.S. Naval Academy.

McCain was buried in a plot at the academy's cemetery shaded by sycamore and maple trees next to his best friend, U.S. Navy Adm. Charles "Chuck" Larson, and surrounded by the graves of military leaders and war heroes.

Following a private 2 p.m. ET burial service at the Naval Academy Chapel, McCain's final wish -- one he wrote about in his memoir, "The Restless Wave: Good Times, Just Causes, Great Fights, and Other Appreciations" -- was fulfilled.

"I want to watch the hawks hunt from the sycamore, and then take my leave bound for a place near my old friend Chuck Larson, in the cemetery on the Severn, back where it began," McCain wrote.

As a hearse carrying McCain's casket entered the Naval Academy in Annapolis, Maryland, hundreds of people lined the streets, many waving American flags, some saluting the one-time Navy aviator.

At 4 p.m., as McCain's body was laid to rest, a squadron of military jets flew over the cemetery in so-called "missing man" formation.

About 20 years ago, retired Navy Capt. Jo Dee Jacob was tasked with the duty of finding the plot in the 150-year-old cemetery. The orders came from Jacob's boss, Larson.

"He said find me four plots at the Naval Academy Cemetery where John and I and Cindy and Sally can be buried together," Jacob, referring to the wives of McCain and Lawson, told ABC affiliate KGTV in San Diego.

"So we went out there and there was nothing left," Jacob said.

Not to be deterred, Jacob went about seeking to have some of the reserved plots rearranged to accommodate the wishes of Larson, who died in 2014.

"Just like a Rubik's cube, we started moving people here and there ... and we started calling people that had a reservation for this spot," Jacob told KGTV.

"When people of that stature have an opportunity to think ahead and wanting to be together it really is a statement of friendship and support and integrity," said Jacobs, whose father served with McCain's father, U.S. Navy Adm. John Sydney McCain Jr., on submarines during World War II.

McCain died on Aug. 25 at his home in Sedona, Arizona, following a year-long battle with glioblastoma, an aggressive form of brain cancer. He was 81.

Thousands of Arizonans on Wednesday flocked to the state Capitol Building in Phoenix, where the Republican senator laid in state.

During a memorial service on Friday at the North Phoenix Baptist Church, McCain's good friend former Vice President Joe Biden, a long-time Democrat, gave an emotional eulogy, saying, "All politics is personal. It's all about trust. I trusted John with my life... and I think he would trust me with his."

The flag-draped coffin holding McCain's body was flown to Washington, D.C., aboard Air Force Two, the plane reserved for the vice president. On Friday, he was honored by House and Senate members from both sides of the political aisle as he laid in state in the rotunda of the U.S. Capitol Building.

On Saturday, friends, family and political leaders, including three former presidents, filled the Washington National Cathedral for McCain's funeral service.

"The thing about John's life was the amazing sweep of it," former President George W. Bush said during his eulogy to McCain.

Bush recounted McCain's more than five years in a prisoner of war camp in Vietnam to his six terms in the U.S. Senate.

"Wherever John passed throughout the world, people immediately knew there was a leader in their midst," Bush said. "In one epic life was written the courage and greatness of our country."

Former President Barack Obama also gave a eulogy and revealed that he and his opponent in the 2008 presidential race had frequent private meetings at the White House.

"We enjoyed the time we shared away from the bright lights," Obama said. "And we laughed with each other. And we learned from each other. And we never doubted the other man's sincerity or the other man's patriotism. Or that when all was said and done, we were on the same team."

In an emotional address that moved mourners to tears, McCain's daughter, Meghan, said, "John McCain was defined by love."

"The best of John McCain, the greatest of his titles and the most important of his roles, was father," said Meghan McCain, a co-host of ABC's "The View."

In a veiled swipe at President Donald Trump, who was not invited to the funeral, she said, "We gather here to mourn the passing of American greatness, 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 live lives of comfort and privilege while he suffered and served."

During his presidential campaign, Trump, a billionaire land developer and TV reality show host, criticized McCain's military service during an interview, saying, "He's not a war hero. He's a war hero because he was captured. I like people that weren't captured."

But Meghan McCain took a not-so-subtle dig at the president Saturday, seemingly using his slogan, "Make America Great Again," against him.

"The America of John McCain has no need to be made great again because America was always great," she said.