The State Department strongly discourages Americans from traveling to the country, but it is not illegal to do so.

Gov. John Kasich of Ohio, a Republican candidate for president, said in a statement on his website that Mr. Warmbier’s detention “was completely unjustified and the sentence North Korea imposed on him is an affront to concepts of justice.”

Mr. Kasich, who has spoken with Mr. Warmbier’s parents and has repeatedly called on North Korea to free Mr. Warmbier, said in the statement that “continuing to hold him only further alienates North Korea from the international community.”

Phil Robertson, the deputy Asia director for Human Rights Watch, said that the punishment of “15 years’ hard labor for a college-style prank is outrageous and shocking.”

Mr. Warmbier’s punishment was announced less than a day after Bill Richardson, a longtime American diplomat and former governor of New Mexico who has visited Pyongyang a number of times, met with two North Korean officials in New York to urge Mr. Warmbier’s release on humanitarian grounds.

Mr. Richardson, who had been asked by Mr. Kasich to become involved in the case because of his experience in dealing with North Korea, suggested that the punishment should not necessarily be taken at face value.

“An unfortunate development but a familiar pattern with American detainees,” Mr. Richardson said in an email. “Hopefully a prelude to negotiations that might lead to a release on humanitarian grounds.”

Mr. Warmbier, who entered North Korea as part of a tour group, was detained on Jan. 2 as he was about to board a plane to leave the country. In announcing his arrest, the state news media said that Mr. Warmbier had visited with the intent of “bringing down the foundation of its single-minded unity.”