Media playback is unsupported on your device Media caption There have been scenes of anger outside the Seoul court

South Korea's President Park Geun-hye has become the country's first democratically elected leader to be forced from office.

Judges unanimously upheld parliament's decision to impeach Ms Park over her role in a corruption scandal involving her close friend, Choi Soon-sil.

She now loses her presidential immunity and could face criminal charges.

There have been angry scenes outside the court. Police said two protesters had died.

The court ruling is the culmination of months of political turmoil and public protest. An election must now be held within 60 days.

Ms Park's office said she would not be leaving the Blue House, South Korea's presidential palace, on Friday nor making any statement.

Acting President Hwang Kyo-ahn has called for calm, saying the government should remain stable to prevent internal conflict from spreading.

Why did Park lose her job?

Image copyright Reuters Image caption Ms Park has also lost her presidential immunity and can be prosecuted

At the heart of the drama lies the close friendship between the president and Ms Choi.

Ms Choi is accused of using her presidential connections to pressure companies to give millions of dollars in donations to non-profit foundations she controlled.

Ms Park is alleged to have been personally involved in this, and to have given Ms Choi unacceptable levels of access to official documents.

Parliament voted to impeach Ms Park in December and the Constitutional Court has since been deciding whether to uphold or overturn this.

On Friday, a panel of eight judges ruled Ms Park's actions "seriously impaired the spirit of... democracy and the rule of law".

The court said she had broken the law by allowing Ms Choi to meddle in state affairs, and had breached guidelines on official secrets by leaking numerous documents.

Ms Park had "concealed completely Choi's meddling in state affairs and denied it whenever suspicions over the act emerged and even criticised those who raised the suspicions," it said.

But the judges dismissed some charges, including accusations Ms Park had infringed on freedom of the press by creating a media blacklist of cultural figures, and criticism of her response during the 2014 Sewol ferry disaster.

Read more:

What happens now?

Ms Park was already suspended from presidential duties, with the prime minister taking over her responsibilities.

But she must now leave office - and her official residence - and a presidential election will be held within the next 60 days.

She has also lost her presidential immunity so could now face criminal charges over allegations she colluded with Ms Choi.

What has been the reaction?

Image copyright EPA Image caption Park supporters turned on police vans outside the court

As the various twists and turns of the scandal came to light public fury across South Korea intensified, with many staging demonstrations calling for her to step down.

The final decision is being celebrated by many, but as the verdict came through angry scenes erupted outside court. Pro-Park protesters - mostly older conservatives - turned on police. Two people believed to be pro-Park died.

South Korea's Yon hap news agency reported that one was killed when a loudspeaker fell on them, while an elderly man fell from a police van.

What does it mean for South Korea?

Besides a possible criminal trial for Ms Park, there is also the ongoing prosecution of Ms Choi.

The de-facto head of Samsung, Lee Jae-yong, is also on trial for a string of corruption charges linked to the scandal.

Image copyright AFP Image caption Ms Choi (centre) has been accused of bribery and corruption

Analysts say the protests in recent months have sent a strong signal that the close relationship between politicians and the chaebols - large family businesses that dominate the economy - needs to change.

A new election could change the political landscape of South Korea. But society remains deeply divided.

At the scene - Stephen Evans, BBC News, Seoul

The moment the judgement was announced, there was cheering in the streets. But there is also pro-Park feeling.

The country is split and nobody quite knows what will happen. One argument is that if a court can remove a president, democracy is not weak.

Image copyright Getty Images Image caption Distraught supporters of Ms Park wept outside the constitutional court in Seoul after the verdict was announced

The outcome is uncertain, but polls indicate a leftward shift. If the government does move to the left, that has consequences for the relationship with North Korea and the United States.

A leftish government might well re-open the industrial complex just inside North Korea, but with South Korean firms and managers. It might also seek more contact with North Korea, running counter to recent US-South Korean policy.

There is also a personal tragedy here. Ms Park is the daughter of Park Chung-hee, the general who seized power in 1961 and who set the country on a route towards industrialisation. He was assassinated, as was her mother.

She has lived an isolated life ever since, even as president. She has relied on her best friend for 40 years - Choi Soon-sil.

The friendship has cost her the presidency and an honourable place in history. It may now put her behind bars.