“Although we had no reason at all to show mercy to such a criminal of the enemy state, we provided him with medical treatment and care with all sincerity on a humanitarian basis until his return to the U.S., considering that his health got worse,” said the statement, carried by the North’s official Korean Central News Agency.

Mr. Warmbier was arrested in the North in January 2016 while visiting the country on a tourist visa. Two months later, he was sentenced to 15 years of hard labor, accused of committing a “hostile act” by trying to steal a political poster from his hotel in Pyongyang, the capital.

His coma and subsequent death have set off outrage in the United States. President Trump condemned the North’s “brutality,” and other political leaders demanded that it explain what happened to Mr. Warmbier.

Until Friday, North Korea had said only that it released the young man on “humanitarian grounds.” It told American officials that Mr. Warmbier had contracted botulism and fallen into a coma after taking sleeping pills, according to his family, which was briefed by the officials. The family rejected that explanation, saying he had been “brutalized and terrorized.”

On Friday, the Foreign Ministry spokesman did not disclose what caused Mr. Warmbier’s coma. But the spokesman, whom state news did not identify, said that American doctors who flew to Pyongyang to evacuate Mr. Warmbier recognized that the North had “provided him with medical treatment and brought him back alive” after his “heart was nearly stopped.”