Mena Massoud will play Aladdin in Disney’s live-action film. (Denise Grant)

After a months-long casting search for the lead in Disney’s forthcoming live-action version of “Aladdin” — a search that had been criticized for its sluggish pace — the studio announced Saturday that Mena Massoud will take on the role of the resourceful street urchin.

The Egyptian-born Canadian actor, a relative newcomer, stars in the Amazon series “Jack Ryan.” According to Disney, which announced the casting at the D23 Expo, Massoud will join Naomi Scott as Jasmine and Will Smith as Genie.

Director Guy Ritchie had previously come under fire after English actor Tom Hardy was mentioned as a possibility for the role of the villain Jafar, leading to accusations of “whitewashing” parts that should go to actors of Middle-Eastern descent. (Hardy later denied that he had been offered the role.) When the 1992 animated film “Aladdin” came out, starring Scott Weinger, Linda Larkin, Robin Williams and Jonathan Freeman, Disney was criticized for ethnic stereotyping. The angst with which the studio seemed to be approaching the challenge of identifying a Middle Eastern actor who can sing, dance and act led to some interesting volunteers offering their services on Twitter, including Pakistani American actor and “Silicon Valley” star Kumail Nanjiani: