RIYADH, Saudi Arabia — Women will be allowed to drive for the first time next summer in Saudi Arabia, the ultra-conservative kingdom announced Tuesday, marking a significant expansion of women’s rights in the only the country that barred them from getting behind the wheel.

While women in other Muslim countries drove freely, the kingdom’s blanket ban attracted negative publicity for years. Neither Islamic law nor Saudi traffic law explicitly prohibited women from driving, but they were not issued licenses and were detained if they tried to drive.

Prince Khaled bin Salman, Saudi Arabia’s ambassador to Washington and the king’s son, said letting women drive is a “huge step forward” and that “society is ready.”

“This is the right time to do the right thing,” he told reporters in the U.S. Women will be allowed to obtain licenses without the permission of a male relative.

The announcement came in the form of a royal decree that was reported late Tuesday by the state-run Saudi Press Agency and state TV.

“I am really excited. This is a good step forward for women’s rights,” said Aziza Youssef, a professor at King Saud University and one of Saudi Arabia’s most vocal women’s rights activists. Speaking to The Associated Press from Riyadh, she said women were “happy,” but also that the change was only “the first step in a lot of rights we are waiting for.”

Saudi history offers many examples of women being punished simply for operating a vehicle.

In 1990, 50 women were arrested for driving and lost their passports and their jobs. More than 20 years later, a woman was sentenced in 2011 to 10 lashes for driving, although the late King Abdullah overturned the sentence.

As recently as late 2014, two Saudi women were detained for more than two months for defying the ban on driving when one of them tried to cross the Saudi border with a license from neighboring United Arab Emirates in an act of defiance.

For years, the kingdom has incrementally granted women more rights and visibility, including participation in the Olympic Games in London and Rio, positions on the country’s top consultative council and the right to run and vote in local elections in 2015.

Despite these openings, Saudi women remain largely subject to the whims of men because of guardianship laws, which bar them from obtaining a passport, traveling abroad or marrying without the consent of a male relative. Women who attempt to flee abusive families have also faced imprisonment or been forced into shelters.

King Salman and his young son and heir, Crown Prince Mohammed bin Salman, tested the waters over the weekend by allowing women into the country’s main stadium in Riyadh for annual celebrations of the nation’s founding. The stadium had previously been reserved for all-male crowds to watch sporting events.

Women and men also flooded a main street in the capital, bopping their heads to pop music as green lights flickered overhead in the color of the flag. The scene was shocking for a city in which gender segregation is strictly enforced and where women are seldom seen walking the streets, much less mixing in close quarters with males.

The 32-year-old crown prince has also opened the country to more entertainment, allowing musical concerts and even a Comic-Con event as part of a wide-ranging push to reform the economy and society. This year, the government announced that for the first time, girls in public schools would be allowed to play sports and have access to physical education. To celebrate Tuesday’s decree, several Saudi women posted images on social media deleting their ride sharing apps.

State Department spokeswoman Heather Nauert called the move “a great step in the right direction.” She did not comment on whether Saudi Arabia still needs to do more to ensure full rights for its female citizens.