People who were born in New York City and do not identify as male or female can now opt for a third gender category of X on their birth certificates.

Mayor Bill de Blasio signed the provision into a law on Tuesday, making New York City the fifth place to do so after California, Oregon, Washington state and New Jersey. Three states and Washington, D.C., also allow gender-neutral driver licenses.

Mayor Bill de Blasio signed the provision into a law on Tuesday, making New York City the fifth place to create a gender-neutral birth certificate. Gary Gershoff / Getty Images for Housing Works file

Transgender advocates have been pressing governments to allow identity documents to be more easily changed to match gender identity. They say strict male and female categories are a form of discrimination against transgender people that labels them against their will.

The New York City law allows nonbinary and gender-nonconforming people to change their birth certificates from the M or F designation they were assigned at birth to X with a personal affidavit. No document from a doctor is required.

"This change may seem small but it is monumental," said Tanya Asapansa-Johnson Walker, a transgender activist who took part in the signing ceremony and spoke of the anxiety that goes with living with gender-mismatched identification.

"Imagine having to out yourself over and over and over again to strangers," Walker said. "Future generations will not have to suffer."

Among those participating in the ceremony was actor Asia Kate Dillon, a nonbinary person who plays one on the cable television series "Billions." Assigned female at birth, Dillon identifies as neither male nor female and uses they, them and their as pronouns.

Asia Kate Dillon as Taylor in Showtime's "Billions." Jeff Neumann / SHOWTIME

The gender-neutral birth certificate follows a 2014 law that allowed transgender people in New York City to easily change the gender on their birth certificates from male to female or vice versa by removing the requirements of a legal name change and surgery. Now non-binary people can choose the third option.

The issue of what happens when another state does not recognize the X designation has yet to be tested in the courts.

To change passport gender, the U.S. government requires a physician to confirm the person has received clinical treatment for gender transition. So far there are only male or female designations on passports, but a U.S. District Court in Denver ruled in September that the State Department cannot deny a gender-neutral passport to an intersex person.

De Blasio said the law afforded New Yorkers the freedom to "tell the government who they are and not the other way around."

"Imagine if you were told you were something that you did not consider yourself to be," de Blasio said.

To transgender New Yorkers, he said, "You be you. Live your truth. And know that New York City will have your back."

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM