AJ Stachelek anticipated that a lot would change when he began his gender transition in November 2011. He started taking hormones. His voice got deeper and he grew facial hair. A year later, he got top surgery to remove his breasts. He finally felt comfortable in his body.

"I'm much more identifiably male by most people at this stage of my life," said Stachelek, who lives in New York City with his wife. "All my documentation has me as a male; my marriage license lists me as a husband, my driver's license, my social security [card] — all of that matches my appropriate gender marker."

But his birth certificate — the key that unlocks many of the benefits of American citizenship — did not.

The problem became apparent in 2014, when Stachelek and his wife were planning a getaway to Cancun, Mexico. He wanted his passport to identify him as the rest of the world now did, but there was a problem. Stachelek was born in Massachusetts, one of 29 states that require transgender people to undergo sex reassignment or "bottom" surgery in order to change the gender marker on their birth certificate — one form of identification that's required to apply for a passport.

Whether a person's birth certificate is an accurate reflection of their gender identity largely depends on the state in which they were born.

Birth certificates have emerged as a new battleground in the fight for transgender rights. Some jurisdictions, like New York City, have introduced municipal IDs that allow people to easily list their preferred gender markers. But in many places, if you want to travel, rent an apartment, drive, or get married, somewhere in the process you'll need to show someone a birth certificate. And whether that birth certificate is an accurate reflection of your gender identity largely depends on the state in which you were born.

AJ Stachelek Courtesy of AJ Stachelek

If a transgender person has sex reassignment surgery and can provide an affidavit from a doctor confirming it, there are 29 states that will allow them to change the gender marker on their birth certificates. California, New York and Washington, D.C. have more lenient policies; they only require an affidavit from a licensed health care provider attesting to a person's gender identity. Four states — Tennessee, Ohio, Idaho and Kansas — refuse to change gender markers on birth certificates at all.

Stephanie Mott, left, a transgender woman and activist, and Pedro Irigionegaray, her attorney, speak to reporters following a Kansas state health department hearing on regulatory changes that would make it more difficult to change the gender listed on a person's birth certificate on May 12. John Hanna/AP

"It's in everybody's interest for people to have identity documents that really reflect who they are in the world — the interest of security, the TSA, police," said M. Dru Levasseur, director of the Transgender Rights Project at Lambda Legal, the nation's oldest LGBT legal rights organization.

Birth certificates are a person's primary proof of citizenship: They open the door to access a range of public services, from public school records to applying for a passport or driver's license.

"The birth certificate is where your identity documents start," said Victoria Rodriguez-Roldan, the Trans/Gender Nonconforming Justice Project Director at the National LGBTQ Taskforce. "That means that having your birth certificate reflect who you are and who you identify as provides an enormous sense of validation for a transgender person."

"Historically, there's a lot of weight put on the birth certificate because [birth] is seen as this moment where sex is determined for all purposes, but what's missing there is a fundamental understanding of sex," Levasseur added.

Despite the ease with which doctors mark newborns as male or female after birth, sex and gender are more complicated than looking at a baby's genitals. "Sex" refers to a person's biology, while "gender" usually refers to the actions and feelings society associates with being either a man or a woman. But both sex and gender are fluid — product of a whole host of factors, including chromosomes, hormones and environment. Society is still coming around to the notion that men can have vaginas and women can have penises, and some people may identify as neither.

"The most important one that medical science understands is a person's gender identity — their self-identity," Levasseur said.

In North Carolina, lawmakers recently passed a controversial bill that requires people in the state to use public bathrooms that match the gender on their birth certificates, bringing the fight over transgender people and birth certificates to public attention. The move has inspired other states to follow suit.

"Prior to this whole North Carolina bathroom issue, most states have made it easier for people to change their birth certificate," said Virginia Goggin, an attorney with the Anti-Violence Project, an LGBT rights organization in New York City. "While it's still prohibitive in a lot of states for transgender people to change their birth certificate because the state requires sex reassignment surgery, it was changing."

North Carolina Gov. Pat McCrory speaks during a news conference on May 9. McCrory's administration has sued the federal government over a state law that requires transgender people to use the public restroom matching the sex on their birth certificate. Gerry Broome/AP

In Kansas, lawmakers recently mandated that birth certificates can only be changed if an official made a mistake while recording the person's gender at birth.

For many transgender people — 27% of whom earn on average annual incomes of $20,000 — the cost of surgical transition is prohibitive, which in many states means transgender people can't get documents that reflect their gender identity.

"Not everyone wants sex reassignment surgery or can afford it," said Goggin.

Stachelek eventually got a passport with the correct gender marker, but only after he took multiple trips to the passport agency with a signed, notarized affidavit from the doctor who performed his top surgery in hand.

"That was a pain having to physically go to these locations with these papers," Stachelek said about the bias that he faces from officials at different agencies in the absence of standard policies and procedures. "You never know what the person behind the counter is going to do."