Singapore’s ruling party suffered its worst-ever election result since independence in 1965 as youthful opposition parties tapped voter anger over high living costs and rising inequality in the wealthy city-state.

Unofficial results showed the opposition had garnered around 40 percent of 2 million votes cast in Saturday’s election. But the first-past-the-post parliamentary system – modeled on that of Britain, the former colonial power – ensured that the ruling People’s Action Party (PAP) retained firm control, with 81 out of 87 seats.

For the first time, opposition candidates contested virtually every seat in parliament. They also used social media and the Internet to provide an alternative to state-controlled newspapers. Opposition rallies attracted large boisterous crowds during the campaign period, which lasted just under two weeks.

Speaking late on Saturday, Prime Minister Lee Hsien Loong struck a contrite note in response to the election upset. "Many Singaporeans wish for the government to adopt a different style and approach," Mr. Lee said. "We hear your voice. The PAP will learn from this election and put right what is wrong."

In the most closely watched race, the Workers Party won a multimember constituency by fielding a Harvard-trained lawyer against Foreign Minister George Yao, the lead PAP incumbent, who lost his seat. In previous elections, opposition parties have struggled to recruit top-caliber candidates, in contrast to the PAP’s well-oiled recruitment system.

Analysts say the high-profile role of young professionals in the opposition movement gave it a broader appeal to voters than the left-leaning candidates of previous campaigns. Their next task will be proving that they are a credible alternative to the PAP, which has governed Singapore since independence and keeps a tight grip on public debate.

“What this means is a much greater critical mass of talented opposition MPs in parliament. That’s even more important than the psychological breakthrough of winning a [multimember constituency],” says Michael Montesano, a historian at the Institute of Southeast Asian Studies in Singapore.

The campaign was notable for the defensive tone struck by PAP leaders when confronted with voter frustration over the government’s performance. In the final days of campaigning, Lee apologized for the government’s failure to build enough public housing. Low-income families have complained over the soaring price of property, driven partly by an influx of expatriates and appetite from Asian investors. PAP candidates were also accused of ignoring the plight of ordinary households.

Singapore has a population of more than 5 million people crammed onto an island off the southern tip of Malaysia. Of this, around one-third are expatriates and migrant workers, a proportion that has stirred resentment among native Singaporeans who say that the quality of life has suffered as a result.