The U.S. Navy has dedicated one of its Japan-based guided missile destroyers to ailing U.S. Sen. John McCain.

Navy Secretary Richard Spencer added the Arizona Republican's name to the USS John S. McCain, which had already been named for McCain's father and grandfather. All three generations of McCains have the same name.

"As a warrior and a statesman who has always put country first, Sen. John McCain never asked for this honor, and he would never seek it," Spencer said. "But we would be remiss if we did not etch his name alongside his illustrious forebears, because this country would not be the same were it not for the courageous service of all three of these great men."

The guided-missile destroyer was named after McCain's father and grandfather, both Navy veterans, when it was launched in 1994. McCain was a naval aviator who was imprisoned and tortured during the Vietnam War. The 81-year-old lawmaker is battling brain cancer.

In August 2017, 10 sailors were killed when the McCain collided with an oil tanker near Singapore. Two months earlier, seven sailors died when the destroyer USS Fitzgerald collided with a commercial ship off the coast of Japan.

Spencer told reporters after the ceremony that changes to naval practices recommended after the accidents have been 78 percent implemented. Some are completed, while others such as instilling a culture of continuous learning will take two years.

Work to repair the McCain is ongoing at Yokosuka Naval Base south of Tokyo and Spencer told reporters the Navy hopes to put the ship back out to sea next spring.

Fox News' Chad Pergram and The Associated Press contributed to this report.