KABUL, Afghanistan -- In a victory that brought cheer to this war-torn nation, Afghanistan on Friday beat Kenya in a one-day international cricket match to advance to the World Cup for the first time in its troubled history.

Unfortunately, most of its fans couldn’t enjoy the sweet taste of success in person as their team beat Kenya by an emphatic seven wickets, reaching its target of 94 with 175 balls remaining. Afghanistan can’t play at home because of the security situation, and its stands at the United Arab Emirates stadium were largely empty. But that didn’t deter members of the winning team, who ran onto the field carrying a giant Afghanistan flag.

Back home, there was joy and celebration as word of the victory spread. Thousands of people marched, danced and drove through Kabul’s normally muted streets cheering, honking and shooting guns in the air. “I can’t tell you how happy I am,” said Sayed Rahman Ahmadzai, a former national player and member of the Afghan cricket board. “It was our dream to one day qualify, and we did it today.”

At Kabul's only cricket stadium, some 3,000 people stood on the field to watch the match live on a large screen, waving flags and celebrating each boundary as their team scored four or six runs with a single ball. “Kenya has [115] years of cricket and we have 10,” said Maiwand Habib Wardak, 28, a security official with a short beard, wearing a brown shalwar kameez, the loose-fitting suit worn in the region. “Now we’ve proven we can take on any team in the world.”

Large crowds also celebrated in Jalalabad, where celebratory gunfire was more muted than usual after police warned citizens in radio messages not to fire their guns into the air.

“Whether they win a single match in the World Cup, I don’t care,” said Boria Majundar, a cricket historian and senior fellow at England’s University of Central Lancashire. “Just by being there, it’s a victory. They have a ‘never say die’ attitude, and that’s what sport is all about.”

The Afghan national team has morphed from “a disorganized rag-tag band of nomadic hitters into a well-balanced team that has impressed mightily,” the Malaysia-based Asian Cricket Council said on its website. “They play with dash and panache, care only for winning and consider every match played to be a matter of national honor.”

The vast majority of cricket-playing nations picked up from their former British colonial masters a game that dates back to at least the 15th century. It reportedly was first played by children during Saxon or Norman times in forest clearings around Kent and Sussex until adults developed an interest in the 17th century.

Afghanistan embraced the sport after the 1979 Soviet invasion, when millions of Afghans fled to neighboring cricket-crazy Pakistan.

The Taliban viewed sport as a diversion from Islam but allowed some play provided batsmen and bowlers followed Islamic law, wore a beard and prayed the requisite five times a day.

After the Taliban government fell following the U.S.-led invasion in 2001, cricket-mad refugees returned in force.

Taliban officials were not immediately available for comment on Friday’s victory. However, aware of cricket’s growing popularity, the increasingly media savvy militant group announced on its web page in April 2012 that it would allow the game to be played if it regained power.

Afghan cricket has received a financial helping hand from Persian Gulf nations, especially the United Arab Emirates, which since 2010 has let the Afghan national team use the 25,000-seat Sharjah Cricket Club stadium so it has somewhere to call home.

As the game’s popularity has grown, Afghanistan has increasingly come to resemble the rest of South Asia, with every alley or patch of rough ground transformed into a cricket pitch by youngsters using homemade bats and balls.

At least 2,000 teams now play in provincial, regional and national competition, with leagues in Kabul and Jalalabad attracting large crowds in stadiums once used as Taliban execution grounds. Authorities are even deploying cricket in the service of national reconciliation, local media report, by having players drop surnames that denote their ethnicity.

With Friday’s win, which some have called the most important game in the nation’s short cricket history, the national team secures a berth in the World Cup to be played in Australia and New Zealand in early 2015. “This is great news for cricket, sport and Afghanistan,” said Pradeep Magazine, a New Delhi-based sports columnist.

It’s been a heady rise. Just five years ago, Afghanistan was in World Cricket League Division 5, the lowest-ranked tournament among affiliate members.

“Today, Afghanistan proved its talent to the world,” said Shahzada Masoud, chairman of the Afghan Cricket Board. “It’s an achievement fueled by patriotism and a huge amount of hard work.”

ALSO:

Egyptian troops, protesters clash ahead of Sunday celebrations

Cancellation of Obama's Southeast Asia trip a boost for China's Xi

War, poverty, repression: Why so many Africans risk their lives to migrate 

Twitter: @markmagnier

mark.magnier@latimes.com

Special correspondent Baktash reported from Kabul and Times staff writer Magnier from New Delhi.