WASHINGTON — Twice rejected for U.S. visas, an all-girls robotics team from Afghanistan arrived in Washington early Saturday after an extraordinary, last-minute intervention by President Donald Trump.

The six-girl team and their chaperone completed their journey just after midnight from their hometown of Herat, Afghanistan, to enter their ball-sorting robot in the three-day high school competition starting Sunday in the U.S. capital. Awaiting them at the gate at Washington Dulles International Airport were a U.S. special envoy and Afghan Ambassador Hamdullah Mohib, who described it as a rare moment of celebration for his beleaguered nation.

Trump’s personal intervention earlier in the week using a rare “parole” mechanism to sidestep the visa system ended a dramatic saga in which the team twice traveled from their home in western Afghanistan through largely Taliban-controlled territory to Kabul, where their visa applications were denied.

Ambassador Alice Wells, the acting U.S. special envoy for Afghanistan and Pakistan, downplayed concerns that the girls might use the parole to stay in the U.S. or go to Canada. As she drove to the airport to greet the girls, she said by phone that they were proud to represent Afghanistan and “proud to return to be role models to others around them.”

Competing against entrants from more than 150 countries, the girls will present a robot they devised that can recognize blue and orange and sort balls into correct locations. They’ll also be feted at a hastily arranged reception at the Afghan Embassy by supporters who had petitioned the U.S. to let them in.

“It’s young women like these that are going to be the future of Afghanistan,” Wells said.