Senator John McCain was remembered as a “true American hero” and a terrible driver with a wicked sense of humour at a crowded church service that ended with the playing of Frank Sinatra’s My Way.

Addressing an estimated 3,500 mourners, former vice president Joe Biden recalled “the sheer joy that crossed his face when he knew he was about to take the stage of the Senate floor and start a fight”.

Biden, a Democrat who was among the fast friends the Republican senator made across the aisle, said he thought of McCain as a brother, “with a lot of family fights”.

People watch the motorcade carrying the coffin of John McCain (Jae C. Hong/AP)

The service for the statesman, former prisoner of war and two-time presidential candidate unfolded at North Phoenix Baptist Church in Phoenix, Arizona, after a motorcade bearing McCain’s body made its way from the state Capitol past people waving American flags and campaign-style McCain signs.

Family members watched in silence as uniformed military members removed the flag-draped coffin from a black hearse and carried it into the church.

McCain died last Saturday of brain cancer at 81.

McCain’s longtime chief of staff Grant Woods, a former Arizona attorney general, drew laughs with a eulogy in which he talked about McCain’s “terribly bad driving” and his sense of humour.

The church service brought to a close two days of mourning for the six-term senator and presidential nominee in his home state.

A motorcade then took McCain’s body to the airport, where it was put aboard a military aircraft for the flight east for a lying-in-state at the US Capitol on Friday, a service at the Washington National Cathedral on Saturday, and burial at the US Naval Academy in Annapolis, Maryland, on Sunday.

A military honour guard carries the coffin of John McCain (Ross D. Franklin/AP)

Neither Biden nor other speakers uttered President Donald Trump’s name, but Biden made what some saw as a veiled reference to the president when he talked about McCain’s character and his opposition to those who “lacked the basic values of decency and respect, knowing this project is bigger than yourself”.

McCain clashed openly with Trump, who mocked McCain for getting captured during the Vietnam War. Two White House officials said McCain’s family had asked that Trump not attend the funeral services.

Biden said McCain “could not stand the abuse of power wherever he saw it, in whatever form, in whatever country”.

Dabbing his eyes at times, Biden also referred to his own son’s death from cancer, saying of the disease: “It’s brutal, it’s relentless, it’s unforgiving.”

And he spoke directly to McCain’s widow, Cindy McCain, in the front row: “You were his ballast.”

Sinatra’s My Way paid tribute to a politician who became known for following his own path based on his personal principles.

On Wednesday, a private service was held at the Arizona Capitol for family and friends. McCain’s widow pressed her face against her husband’s coffin, and daughter Meghan McCain erupted in sobs.

An estimated 15,000 people filed past the senator’s casket to pay their final respects, and McCain’s sons Doug, Jack and Jimmy, daughter Sidney and daughter-in-law Renee shook hands with some of them.