KATHMANDU, Nepal (AP) — Nepalese lawmakers elected a longtime women's rights campaigner to become the country's first female president Wednesday, as the Himalayan nation pushes for more gender equality in politics and work life.

Bidhya Devi Bhandari, the 54-year-old deputy leader of Nepal's Communist Party of Nepal Unified Marxist-Leninist, had lobbied actively for the new constitution to require that either the president or vice president be a woman.

Nepal has been trying to shift from a traditionally male-dominated society, where women are mostly limited to working at homes or on farms, to one in which women have equal access to opportunities and legal rights.

Lawmakers cheered as Bhandari's name was announced as the new president. An ally and party colleague of Prime Minister Khadga Prasad Oli, Bhandari had been considered the favorite for the largely ceremonial job.

Bhandari said her election — by a vote of 327-214 against Congress party leader Kul Bahadur Gurung — marked a first step toward assuring the new constitutional guarantees of equality are fulfilled. The constitution, adopted last month, also requires that one-third of the country's lawmakers be women, and that women be included in all government committees.

And last week, Onsari Gharti was elected as the country's first female Parliament speaker.

Bhandari has been a leading political figure since 1993 when her late husband, Communist party Madan Bhandari, was killed in a car accident.

She led demonstrations against the former King Gyanendra in 2006, helping drive the country toward ending his authoritarian rule and restoring democracy.

Bhandari is Nepal's second president since then. She replaces President Ram Baran Yadav, who was elected in 2008 for a two-year term that was extended when efforts to draft a new constitution stalled over seven years.