The U.S. Navy paid tribute on Tuesday to seven sailors who were killed when their destroyer collided with a merchant ship off Japan.

The Japan-based 7th Fleet said more than 2,000 sailors and their families attended the ceremony in Yokosuka, south of Tokyo. They lined the streets waving flags in memory of the victims.

The USS Fitzgerald, carrying nearly 300 crewmembers, and Philippine-flagged container ship ACX Crystal collided in waters off Yokosuka in the pre-dawn hours of June 17. Severe damage to the right side and bottom of the guided-missile destroyer flooded the berths of 116 sailors. Navy divers found the bodies of the seven in the ship after it returned to Yokosuka.

Adm. Scott Swift, commander of U.S. Pacific Fleet, delivers remarks during the service on Tuesday. Raymond D. Diaz III / U.S. Navy via AP

The container ship has left Yokohama, where it was investigated by Japanese authorities, for repairs of its damaged bow at an unspecified shipyard in Japan, its owner, Dainichi Investment Corp., said. It said the ship's captain and several other crewmembers stayed behind for further questioning by the Japanese coast guard.

The 7th Fleet said its theater was filled to capacity for the ceremony honoring the sailors.

Adm. Scott Swift, commander of the U.S. Pacific Fleet, surveyed the ship's damage and praised its crew for saving it from sinking, it said.

Sailors fold seven U.S. flags during the memorial ceremony on Tuesday. Raymond D. Diaz III / U.S. Navy via AP

"It's stunning, absolutely stunning, while we mourn the loss of the seven sailors, that more were not lost," Swift said in a statement. "There was no understanding of what had happened at the moment of impact ... but there was complete understanding of what needed to be done."

The Navy is investigating what happened aboard the warship. Japanese authorities are investigating the container ship and its crew members.

Ordinarily, Japan has the right to investigate maritime collisions in its territorial waters, but in the case of U.S. warships, the U.S. Navy has the primary right to do so under a bilateral Status of Forces Agreement, making it uncertain whether Japan will have access to the U.S. probe.