CASABLANCA, Morocco — It was a slow night on the red carpet at the opening of the Marrakech International Film Festival for the photographers, and everyone was complaining about the lack of celebrities.

Then a car pulled up and out stepped Noor Talbi, Morocco’s most famous belly dancer. The photographers went wild. Darling of the jet set and a fixture for any society party or hotel opening, Noor’s statuesque 6-foot frame was clothed in a spangled, off-the-shoulder ballgown slit up the side to reveal her long legs.

Legs, that as a teenage athlete, won her a gold medal in the 440-meter hurdles at the national level — back when she was a boy who went by the name of Nourreddine.

In this conservative Muslim country where homosexuality is illegal and punishable by up to three years in jail, the transgender Noor is nonetheless not only accepted but is a celebrity. Her ability to seemingly transcend the restrictions of her culture speaks both to her star power and to a certain kind of tolerance toward sexual minorities in this North African nation — and even in the wider Middle East.

There are references to men affecting the clothes and attitudes of women in the Quran. In countries like Iran and Egypt, while homosexuality is illegal, gender change surgery is allowed, especially for those born hermaphrodites. Cross-dressing is also often found in the entertainment world, and in Turkey one of the most famous singers of classical music was also once a man.

Casablanca, Noor’s hometown, looms large in the history of gender-reassignment operations. From the 1950s to the 1970s it was home to the clinic of George Burou, who revolutionized the science of turning men into women, including British model April Ashley and French cabaret dancer Coccinelle.

Noor has starred in several movies, headlined weddings for the wealthy, and is a regular on red carpets and big events. But there are limits. She cannot get her identity card changed to reflect her new gender, and Moroccan state television refuses to put her on air.

“Gender nonconformity is entertaining ... as long as it’s safely confined to a stage or TV screen, not something you meet on the street,” warned Scott Long, a rights activist with long experience in the Middle East. “Social prejudice against people who don’t conform to gender norms is very strong.”

When Noor arrived for her interview with the Associated Press, she glided into the lobby of the Sofitel in Casablanca dressed in a form-fitting black jacket and pants with heeled boots that set her well above everyone else in the room. She sat with the perfect posture of a dancer, and in her husky voice spoke in French about the performances she was giving around the world.

She’s even appeared on American television, with a role on Tyra Banks’ America’s Next Top Model back in 2011, where she taught the aspiring models to dance with a tea set on their head during an episode filmed in Marrakech.

Noor does not want to talk about Nourredine, the boy she used to be, for she is now an “integrated woman,” she said. She referred only in vague terms to her “history,” comparing it to the checkered pasts of Hollywood screen sirens Marilyn Monroe and Rita Hayworth.

“They tell me my costumes are too suggestive or my past — what past? We are speaking now of the woman of today, who is an artist and seduces her public,” she said about the TV executives. Noor often uses the word seduce, and one point gently tugs down the zipper of her jacket as she says it.

Noor’s past is the secret everyone knows but few mention.

While homosexuality is illegal under Morocco’s penal code, the measure is only sporadically enforced. In September, 60-year-old British tourist Ray Cole was arrested along with his young Moroccan boyfriend and sentenced to four months in prison, before being released.

For the most part, though, there is an atmosphere of “don’t ask, don’t tell,” with none of the witch-hunt mentality found in places like Egypt.

Noor isn’t interested in being cast in some sort of activist role for the gay community. She has hung up the phone in the past when contacted by activists. “I don’t consider myself part of that environment, I am now a woman, quite simply, and integrated.”

Noor admits that as she breaks taboos, wows audiences and endures obstinate government officials, the struggle is hard, and she yearns for that final official acceptance. The topic of her 10-year battle to get her gender change officially recognized on her state ID card still incenses her.

“A little piece of paper that’s just 4 cm (1.5 inches), is this going to make me a real woman? I am 1.85 meters of woman and my body explodes with femininity,” she said.

Even so, her words quickened and her eyes flashed in annoyance as she described her humiliation when bureaucrats — or police officers — comment on the disjuncture between what is written on her ID and her appearance.

“If I wasn’t such a strong woman, religious, humanly and social, another might have killed herself,” she said.