SEOUL, South Korea — North Korea will deport an American citizen it detained a month ago for illegally entering the isolated country, state media announced on Friday, in an apparent gesture of good will amid the stalled nuclear talks with the United States.

The North’s decision to release the American, whom it identified as Bruce Byron Lowrance, is likely to be welcomed by Washington as a conciliatory gesture. In the past, North Korea has held Americans on similar charges for prolonged periods, in some cases freeing them only after high-profile figures from the United States went to Pyongyang, the North’s capital, to ask for their release.

Mr. Lowrance was detained on Oct. 16 while illegally crossing into North Korea from China, the North’s official Korean Central News Agency reported. Mr. Lowrance said he had entered the country under the direction of the Central Intelligence Agency, according to the report.

Secretary of State Mike Pompeo, in a statement on Friday, thanked North Korea for its cooperation with the Embassy of Sweden in facilitating his release. The Swedes look after American interests in North Korea because the United States does not have diplomatic relations with the country.