A performance by Elton John sparked outrage among Morocco's anti-gay conservatives.
Islamists were furious at the gay pop star's visit, while the royal palace, government and his many fans backed his appearance last night.
Authorities had beefed up security but no riots or violence was reported, said Rabat's governor, Hassan Amrani. About 50,000 people attended the free concert in a wealthy neighbourhood of the capital, he said.
Other entertainers performing at the festival include Sting, Mika and Carlos Santana and Arab music stars. But in an apparent move to defuse possible tensions, Sir Elton was the only festival artist who dodged local media.
In a sign of Sir Elton's popularity, several thousand of his fans appeared to know his lyrics by heart -- even though most people in the French and Arabic-speaking country know little or no English.
"He is a very big name in the music world, he's a great artist. And his private life is nobody's business," said Leila Hassan, a 43-year-old housewife.
The tension over the concert is part of a tussle between conservatives and modernisers in a nation that criminalises homosexuality but has long been famous for a swinging party scene.
Morocco has attracted gay celebrities such as designer Yves Saint Laurent and writer Paul Bowles, and recently saw the launch of its first gay magazine.
The dispute is between organisers for the Mawazine Festival that invited Sir Elton and the Justice and Development Party, or PJD, Morocco's largest official Islamist group.
It illustrates the growing rift between Western-leaning Moroccan authorities and the more conservative Muslim movements that are on the rise in the kingdom.
"We're an open party, but promoting homosexuality is completely unacceptable," said Mustapha Ramid, a leader and spokesman for the PJD.
Like nearly all Arab and Muslim countries, Morocco is officially hostile to homosexuality.
Homosexual practices are a crime punishable by fines and prison sentences of six months to three years, but in practice, they are almost never applied.