Nepal's parliament has elected a Communist leader who has long campaigned for women's rights as the Himalayan nation's first female president.

Parliament Speaker Onsari Gharti announced that Bidhya Devi Bhandari of the Communist Party of Nepal Unified Marxist-Leninist received 327 votes against her opponent's 214 in parliament on Wednesday.

Bhandari is the deputy leader of the party led by Prime Minister Khadga Prasad Oli. He was elected earlier this month and leads a coalition government.

Bhandari is Nepal's second president since the Himalayan nation was turned into a republic after abolishing the centuries-old monarchy. Ram Baran Yadav remained president for seven years because it took that long for the constitution to be prepared and adopted.