By SUSAN WALSH, Associated Press

ANNAPOLIS, Md. (AP) — Sen. John McCain's final journey ended Sunday on a grassy hill at the U.S. Naval Academy within view of the Severn River and earshot of midshipmen present and future, and alongside a lifelong friend.

A horse-drawn caisson carrying the senator's casket led a procession of mourners from the academy's chapel to its cemetery following a private service. The senator's widow, Cindy, and his children were among those who walked behind the caisson. Joining them were family and friends as well as members of McCain's Class of 1958 and military leaders.

The U.S. Navy band played marches along the way and several hundred Naval Academy midshipmen lined the path. A flyover of military aircraft in "missing man" formation honored the Navy pilot who was shot down over Vietnam and held more than five years as a prisoner of war.

After the American flag was removed from the casket, a grieving Cindy McCain pressed her check to its surface and McCain sons Jimmy and Jack shared a hug. Defense Secretary Jim Mattis presented flags to Cindy McCain and Roberta McCain, the senator's 106-year-old mother.

The burial was private as per the wishes of McCain, the Arizona Republican and 2008 presidential nominee died Aug. 25 from brain cancer at age 81.

Those offering tributes or readings during the funeral service included Sen. Lindsey Graham, R-S.C.; McCain sons Jack and Douglas; retired Gen. David Petraeus, former CIA director; and Mark Salter, McCain's longtime co-author.

Petraeus said McCain was a man of "great courage, unshakable determination, and unwavering devotion to our country and those who defend it," according to remarks released by the family.

Jack McCain said of his father, "He fought hard, obstinately, exuberantly because he liked to fight, but more importantly, because he believed in what he was fighting for." He later added, "My father fought and suffered, endured defeats, rose from the ground and fought again to keep faith with his heroes, to safeguard the country he loved and her causes, to be a better man, and to make a better world."

Earlier, as the hearse carrying McCain passed through a gate and into the academy, there was loud applause from the several hundred people lining the street outside on the hot and muggy summer day. Many held their hands over their hearts and waved American flags. Some shouted, "God bless you."

People in the crowd held signs that read "Senator John McCain Thanks For Serving! Godspeed" and "Rest In Peace Maverick."

For his final resting place, McCain picked the historic site overlooking the Severn River, not Arlington National Cemetery, where his father and grandfather, both admirals, were buried.

Years ago Chuck Larson, an admiral himself and an ally throughout McCain's life, reserved four plots at the cemetery — two for McCain and himself, and two for their wives, now widows. Larson died in 2014, and McCain wrote in a recent memoir that he wanted to be buried next to his friend, "near where it began."

Among the pallbearers on a list provided by McCain's office were Frank Gamboa, his academy roommate; Mattis; and two men who were POWs with McCain in Vietnam, John Fer and Everett Alvarez Jr.

Tributes to McCain began Wednesday in Arizona and continued for the remainder of the week. On Saturday, speeches by his daughter Meghan and two former presidents — Republican George W. Bush and Democrat Barack Obama — remembered McCain as a patriot who could bridge painful rivalries. While their remarks made clear their admiration for him, they also represented a repudiation of President Donald Trump's brand of tough-talking, divisive politics. Trump and McCain were at odds during the 2016 campaign and for much of Trump's presidency.