The United States has decided against the idea of using its largest overseas military bases in South Korea and Japan to house Afghan refugees temporarily, two sources with close knowledge of the matter told Reuters.

U.S. officials "appeared to have figured out better sites and decided to remove both countries from the list because of logistics and geography among other reasons," said one of the sources said on condition of anonymity due to the sensitivity of the issue.

The South Korean government had responded positively when the United States first floated the idea, the source added.

The U.S. State Department did not respond to a request for comment.

South Korea is also working with the United States to evacuate some 400 Afghans who had worked with South Korean troops and relief workers, and bring them to Seoul, the sources said.

Most of the Afghans are medical personnel, engineers, translators and others who had aided South Korean troops stationed there between 2001 and 2014, or took part in a reconstruction mission from 2010 to 2014 involving medical and vocational training.

"Despite some domestic resistance toward accepting refugees, these people helped us and it has to be done given the humanitarian concerns and the trust of the international community," said one of the sources.

Plans to bring them to Seoul were fraught with uncertainty due to the volatile situation in Kabul, where thousands of people are scrambling to the airport, desperate to flee following the Taliban's take over of the Afghan capital on Aug. 15.

The United States and its allies are racing to complete the evacuation of all foreigners and vulnerable Afghans before the expiry of an Aug. 31 deadline agreed with the Taliban.