A team of six Afghan girls nearly missed an international robotics competition before their visas were approved just days before traveling to the U.S. (Patrick Martin/The Washington Post)

With two words — “Team Afghanistan” — the crowd in the stands at DAR Constitution Hall erupted into a deafening roar Sunday as the teenage girls made their way onto a sprawling stage, waving their country’s flag and wearing headscarves in matching colors.

Their triumphant entrance on the stage at the FIRST Global Challenge robotics competition marked the end of a long and uncertain journey to the United States. As of last week, their dream of traveling to what has been billed as the “Olympics of Robotics” had been shot down when their visas were denied, despite two grueling trips from their home in Herat, in western Afghanistan, to Kabul for interviews with U.S. State Department officials.

But after their plight made international headlines, President Trump intervened at the last minute to grant the girls passage to the United States, and they arrived Saturday.

Standing in the busy hallway of Constitution Hall Sunday, while her teammates tinkered with their robot nearby, Fatemah Qaderyu said she was elated to finally make it here. The 14-year-old wants to study computer science when she gets older.

“We feel really good that we can show our talents here,” she said. She said she hopes to show the world what girls like her are capable of: “Afghanistan is not just a place of war. Afghan girls can build robots and compete in global competitions.”

The three-day competition draws teams from 157 countries — and some multinational teams representing continents. One group — Team Hope — is composed of refugees. FIRST Global has long hosted competitions in the United States, but this is the first year it is hosting an international competition. The team representing the United States is composed of three girls, who marched into the auditorium for the parade of nations to the Woody Guthrie song “This Land is Your Land.”

FIRST Global founder Dean Kamen, an inventor known for creating the Segway, said the competition’s objective is not just to teach children to build robots and explore careers in science, technology, engineering and math. He also hopes it drives home the lesson of the importance of cooperation — across languages, cultures and borders.

“FIRST Global is getting them at a young age to learn how to communicate with each other, cooperate with each other and recognize that we’re all going to succeed together or we’re all going down together,” Kamen said.

Monday’s competition began on the central stage. Hundreds of participants crowded around their robots in the hallways, making last-minute adjustments and filling the space with a nervous, excited energy.

On the central stage in the auditorium, the “playing field” consisted of a large raised platform with artificial grass, and a “river” painted blue where plastic balls — some orange and some blue — flowed out at the start of the matches. The objective is to collect and sort as many balls as possible, with the blue and orange balls representing clean and contaminated water, respectively.

Three teams were paired together to form alliances that then were pitted against other alliances to win games. But as in any competition, there were unseen challenges. Some robots got stuck on the terrain. Others had driving mishaps and could not navigate the ramps of the playing fields.

But the competition also forged some unlikely partnerships. Before one morning match, the teams from Belarus, Israel and the Solomon Islands gathered in a circle, put their hands together and cheered “Team Hydro!” When an alliance of the teams from Luxembourg, Malta and the Palestinian territories bested their opponents, the Palestinian girls squealed with delight and high-fived the boys from Luxembourg.

Anika Duffus, a 17-year-old from Kingston, Jamaica, said her alliance lost its morning competition, an outcome she attributed to “first-match jitters.” Their robot’s color sensor, which helps it sort the orange from the blue balls, failed and balls got stuck in the robot’s elevator. She said she learned that communication — as much as technology prowess — is key to the competition.

“I feel that the communication could have been a lot better,” Anika said.

The international nature of the competition came with complications. Besides the girls from Afghanistan, the team from Gambia also had visa delays, according to the Associated Press, before their applications were also ultimately approved. Because of sanctions, FIRST Global was unable to ship a robotics kit to Iran, where a group of teenagers awaited the parts to build a robot.

That might have spelled the end of the team’s shot of going to the world championships. But the organization introduced the Iranian team to a group of teenage robotics enthusiasts at George C. Marshall High School in Falls Church, Va., calling themselves Team Gryphon. The team in Iran sketched out blueprints on the computer and sent the designs to their counterparts across the ocean and then corresponded over Skype.

Sunday, the team flew the Iranian flag at their station next to the flag of Team Gryphon — a black flag with a purple silhouette of the gryphon — as a sign of their unlikely partnership. For Mohammadreza Karami, the team’s mentor, it was an inspiring example of cooperation.

“It’s possible to solve all of the world’s problems if we put aside our politics and focus on peace,” Karami said.

Kirsten Springer, a 16-year-old rising junior at Marshall High, said she didn’t want the Iranian team to be locked out of the competition just because of the sanctions.

“Everybody should be able to compete … and to learn and to use that experience for other aspects of their life,” she said.

Sharif Hassan contributed to this report. 

An earlier version of this story misspelled the name of Kirsten Springer. This story has been updated.