Charles Robert Jenkins, an Army sergeant who became a Cold War enigma after he defected to North Korea in 1965 and was kept there for nearly 40 years, died on Monday in Japan. He was 77.

His death was reported by the Kyodo News agency, which said the cause was not yet known.

Mr. Jenkins — who was born in Rich Square, N.C., on Feb. 18, 1940 — was patrolling the demilitarized zone that separates North and South Korea when, drunk after 10 beers, he walked into the North in 1965 to avoid facing combat duty in Vietnam.

He quickly realized he had made a terrible mistake. He spent years held with other American defectors, forced to read the works of North Korean leaders for hours on end and suffering from hunger and beatings.

Little was known about Mr. Jenkins’s experiences until he emerged from North Korea in 2004. He was allowed to leave to rejoin his wife, Hitomi Soga, a Japanese woman who had been kidnapped by North Korea. She was allowed to return home to Japan with four other abductees in 2002 after a visit to Pyongyang by the Japanese prime minister at the time, Junichiro Koizumi.

During his 2004 military trial for desertion, held in Japan, Mr. Jenkins testified that he was taken to a hospital in North Korea where, without anesthesia, a doctor sliced off skin with the tattooed words “U.S. Army” from his forearm.

He said he was warned that any criticism of North Korea’s ruling Kim family would have led to his death. He testified at his trial that his captors threatened, “Go dig your own hole, because you are gone,” adding, “I have seen that done.”

He wrote later that he believed his life was somewhat better than those of most North Koreans. He taught English to North Korean military cadets, appeared in propaganda leaflets and films, and said that his role as a war trophy for the North saved him from the worst abuses.

“But still, I suffered from enough cold, hunger, beatings and mental torture to frequently make me wish I was dead,” he said in the 2008 book “The Reluctant Communist: My Desertion, Court-Martial, and Forty-Year Imprisonment in North Korea,” written with the journalist Jim Frederick.

In 1972 he and three other American defectors were given North Korean citizenship, and their lives improved somewhat. In 1980 he met Ms. Soga, who had been kidnapped by North Korean agents as part of an effort to teach Japanese language and culture to spies. The two married soon after.

They lived together in a Pyongyang home that went unheated through most of the winter, raising their own vegetables and chickens to compensate for a collapsing food rationing system. They had two daughters, born in North Korea, who were able to leave with Mr. Jenkins in 2004.

In Japan, public sentiment was largely behind Mr. Jenkins because of the suffering of his wife and other Japanese abductees.

After arriving there, Mr. Jenkins faced a court-martial, where he pleaded guilty to desertion and aiding the enemy. He was demoted to private, stripped of back pay and benefits and given a 30-day jail sentence along with a dishonorable discharge.

“I was released five days early, for good behavior,” he wrote.

After his release, Mr. Jenkins and his wife lived on Sado Island, off the west coast of Honshu, where she grew up and was abducted in 1978. He worked as a greeter at a tourist attraction, posing for photos with visitors who greeted him as “Jenkins-San!” The Los Angeles Times reported in a profile last August.

The article said his daughter Mika lived at home and taught in a kindergarten, while his other daughter, Brinda, lived in the nearby city of Niigata.

“I’d like to go back to the U.S., but my wife don’t want to go, and I have no means to support her there,” Mr. Jenkins told the newspaper. “So I figure, might as well stay where I’m at.”