LAHORE, Pakistan (Thomson Reuters Foundation) - Pakistan will count transgender people in its national census for the first time when it surveys its population in March this year following a top court ruling on Monday.

The Lahore High Court issued the order to the government, National Database and Registration Authority, and the interior ministry with a government official assuring the court that the transgender community will be part of the 2017 census.

This stemmed from a petition filed by transgender Waqar Ali last November that argued Pakistan's transgender community had been marginalized and their fundamental rights should be recognized by including them in the sixth national census.

"We are glad that we will be counted as will be other people," transgender rights worker Almas Bobby told the Thomson Reuters Foundation.

"Hope we get equal citizenship and equal status."

There are no official figures on the number of transgender people living in Pakistan but advocacy group Trans Action estimates there are at least 500,000 in the country with a population of 190 million.

In 2012, Pakistan's Supreme Court declared equal rights for transgender citizens, including the right to inherit property and assets, preceded a year earlier by the right to vote.

But shunned by mainstream society, transgender individuals in Pakistan are still often forced into begging, prostitution or dancing to earn a living.

However transgender people are also sometimes venerated in the South Asian tradition of according spiritual powers to eunuchs and others who fall outside traditional gender divisions.

Nepal's 2011 census was hailed as the first national census globally to allow people to register as a gender other than male or female while India also counted transgender people in its national census for the first time in 2011.

In 2013 Germany became the first European country to allow parents of babies born with no clearly-defined gender characteristics to leave the 'male/female' field on birth certificates blank, creating a 'third sex' category.

Citizens of Australia, New Zealand and Bangladesh can choose from three genders for their passports.

Pakistan, estimated to be the sixth largest country by population, will conduct its national census in March following a gap of nearly 19 years.

The last census was carried out in 1998 when the population was calculated at 132 million people.