WASHINGTON -- Two members of Congress flew unannounced into Kabul airport in the middle of the chaotic evacuation stunning State Department and U.S. military personnel who had to divert resources to provide security and information to the lawmakers, U.S. officials said.

Rep. Seth Moulton, D-Mass., and Rep. Peter Meijer, R-Mich., flew in and out on charter aircraft and were on the ground at the Kabul airport for several hours Tuesday. That led officials to complain that they could be taking seats that would have otherwise gone to other Americans or Afghans fleeing the country, but the congressmen said in a joint statement that they made sure to leave on a flight with empty seats.

"As Members of Congress, we have a duty to provide oversight on the executive branch,"' the two said in their statement. "We conducted this visit in secret, speaking about it only after our departure, to minimize the risk and disruption to the people on the ground, and because we were there to gather information, not to grandstand."

The two lawmakers are both military veterans, with backgrounds in the region. Moulton, a Marine who has been outspoken critic of the Iraq War, served multiple tours in Iraq. Meijer was deployed as part of the Army Reserves and later worked in Afghanistan at a nongovernmental organization providing aid. Moulton serves on the House Armed Services Committee and Meijer is on the House Foreign Affairs Committee.

Three officials familiar with the flight said that State Department, Defense Department and White House officials were furious about the incident because it was done without coordination with diplomats or military commanders directing the evacuation.

The U.S. military found out about the visit as the legislators' aircraft was inbound to Kabul, according to the officials. The officials spoke on condition of anonymity to discuss ongoing military operations.

One senior U.S. official said the administration saw the lawmakers' visit as manifestly unhelpful and several other officials said the visit was viewed as a distraction for troops and commanders at the airport who are waging a race against time to evacuate thousands of Americans, at-risk Afghans and others as quickly as possible.

House Speaker Nancy Pelosi issued a statement Tuesday evening taking note of the desire of some legislators to visit Afghanistan and saying she was writing to "reiterate that the Departments of Defense and State have requested that Members not travel to Afghanistan and the region during this time of danger. Ensuring the safe and timely evacuation of individuals at risk requires the full focus and attention of the U.S. military and diplomatic teams on the ground in Afghanistan."

The Pentagon has repeatedly expressed concerns about security threats in Kabul, including by the Islamic State group. When members of Congress have routinely gone to war zones over the past two decades, their visits are typically long planned and coordinated with officials on the ground in order to ensure their safety.

U.S. President Joe Biden on Tuesday said he is sticking to his Aug. 31 deadline for completing the risky airlift as people flee Taliban-controlled Afghanistan.

The two congressmen said they went into their visit wanting "to push the president to extend the August 31st deadline. After talking with commanders on the ground and seeing the situation here, it is obvious that because we started the evacuation so late, that no matter what we do, we won't get everyone out on time, even by September 11."

------

Associated Press writers Lisa Mascaro and Matthew Lee contributed to this report

Correction:

This story has been corrected to reflect that Rep. Peter Meijer serves on the House Foreign Affairs Committee, not the House Armed Services Committee