SEOUL, South Korea — The South Korean military vowed revenge without identifying a target as the country gave an emotional farewell on Thursday to the sailors killed when their ship sank last month near a disputed sea border with North Korea.

If the ship is found to have been torpedoed by North Korea, as many South Koreans suspect, it will amount to one of the most serious provocations from the North in recent decades. Seoul has repeatedly vowed “stern countermeasures” but has shied from publicly discussing its options until an investigation is over.

Military retaliation, however, is unlikely, analysts say.

“We’ll never forgive whoever inflicted this great pain on us,” said the navy chief of staff, Kim Sung-chan, at a mass funeral for the victims on Thursday in the port city of Pyeongtaek, about 45 miles south of Seoul, home of the ship’s naval base. “We will track them down to the end and we will, by all means, make them pay for this.”

Sirens wailed, flags flew at half-staff and navy ships sounded whistles as South Korea honored the 40 sailors known to have died and 6 others who are missing and presumed dead.