Image copyright Reuters Image caption Ms Bhandari (centre) was elected president on Wednesday night by Nepal's parliament

Nepal's parliament has elected women's rights campaigner Bidhya Devi Bhandari as its first female president, in a move hailed as a milestone.

She is the second person to hold the mainly ceremonial role.

The 54-year-old is currently the vice-chair of the ruling Communist Party of Nepal (United Marxist Leninist).

Ms Bhandari was defence minister from 2009 to 2011. As president, she has promised to champion minority and women's rights in Nepal.

Earlier this month, Nepal's parliament chose its new prime minister, KP Sharma Oli.

Analysis: Charles Haviland, BBC News South Asia editor

Bidhya Bhandari is a close ally of the new prime minister, from the same nominally communist party. She has long been a political activist in a male-dominated society.

In the pre-democracy era, she worked underground, later getting elected to parliament after her politician husband was killed in a mysterious car crash.

Some have questioned her feminist credentials, as she supports citizenship laws they say are anti-women. Yet she helped ensure a one-third quota for women in parliament.

Now, as president, she's supreme commander of the armed forces. But her largely ceremonial role will probably restrict her from indulging in too much politics.

Ms Bhandari replaces Ram Baran Yadav, who was the country's first elected president in 2008 after Nepal abolished its monarchy.

Image copyright EPA Image caption Ms Bhandari was presented with colourful garlands and scarves by supporters, including former prime minister Madhav Kumar Nepal (with blue scarf)

Her election comes shortly after Nepal put in place its new constitution in September aimed at stabilising the country, but which ended up sparking deadly violence, killing at least 40 people.

The constitution defines the majority Hindu nation as a secular republic divided into seven federal provinces.

But ethnic groups in southern Nepal want more territory and rights for ethnic federal states.

Read more: Why is Nepal's new constitution controversial?