Transgender people could be jailed if they use a public toilet designated for a gender other than the one stated on their birth certificates, under a new law passed by a city in Alabama.

An ordinance outlining the prohibition was unanimously passed on Tuesday by the city council of Oxford, a city with a population of about 21,000, in the south-eastern state.

The law states: “Citizens have a right to quiet solicitude and to be secure from embarrassment and unwanted intrusion into their privacy while utilising multiple occupancy bathroom or changing facilities by members of the opposite biological sex.

“There is a long standing history of restricting access to single-sex public facilities on the basis of sex and that users of multiple occupancy bathrooms or changing facilities do not reasonably expect to be exposed to individuals of the opposite sex while utilising those facilities.”

The ordinance goes on to define “biological sex” as “the physical condition of being male or female, which is stated on a person’s birth certificate”.

Anyone caught violating the terms of the ordinance would be fined $500 or be jailed for a maximum of six months, it said.

The pioneers of LGBT rights in 2015 Show all 6 1 /6 The pioneers of LGBT rights in 2015 The pioneers of LGBT rights in 2015 Justice Anthony Kennedy and the other Supreme Court Justices who legalised same sex marriage in the US The US Supreme Court legalized same-sex marriage is all 50 states of America in June, splitting 5-4 in favour. Writing the majority opinion, Justice Kennedy said gay people hope not to be condemned to live in loneliness, excluded from one of civilization’s oldest institutions. The pioneers of LGBT rights in 2015 Caitlyn Jenner After she revealed her new self in an interview and cover with Vanity Fair magazine in June, the former olympian quickly became the most famous trans person in the world. AFP/Getty The pioneers of LGBT rights in 2015 Cara Delevigne The former model said she identified as bisexual in an interview with Vogue in July. AFP/Getty The pioneers of LGBT rights in 2015 Ellen Page The openly gay actress confronted Republican presidential candidate Ted Cruz at a campaign rally in Iowa in August over laws that discriminate against the LGBT community. AFP/Getty The pioneers of LGBT rights in 2015 iO Tillett Wright The artist and Instagram star began the Self Evident Truths project in 2015 to photograph everyone who doesn’t identify as “100% straight”. Famously it featured Johnny Depp’s teenage daughter Lily Rose who said she fell “somewhere on the vast spectrum” and singer Selena Gomez who addressed rumours she was dating Cara Delevigne. AFP/Getty The pioneers of LGBT rights in 2015 Ruby Rose Australian born Rose was one of the very first celebrities to come out as genderfluid. She was hailed for giving it a public platform a the MTV Europe Music Awards in October when she welcomed “ladies and gentlemen, and everyone in-between” in her introduction.

The Alabama branch of the Human Rights Campaign (HRC) group condemned the move, branding it “horrific” and “unprecedented in its establishment of criminal penalties for violations of the law”.

It said it was not yet clear whether people would be required to produce their birth certificates when using public toilets.

“This ordinance is a shameful and vile attack on the rights and privacy of transgender people,” said Eva Walton Kendrick, HRC Alabama state manager.

“Transgender people are our neighbours, our co-workers and our fellow churchgoers, and every Alabamian has the right to live their lives without fear of discrimination and prejudice.

“Throughout the country, elected officials from both sides of the aisle, along with hundreds of business leaders and advocates throughout the country have resoundingly rejected these kinds of proposals, which only seek to demean and marginalise the transgender community.”

Steven Waits, president of the city council, reportedly said that the new law was passed in response to a policy announced by a store in a shopping centre in the city last week, which would have allowed transgender employees and shoppers to use the toilet that matched their identity.

According to the Alabama Local news website, the city’s police chief, Bill Partridge, said the law would be enforced like any other city ordinance such as noise violations or public indecency.

Maria Munir told President Obama they were a non-binary person last week

He said: “If somebody sees something that makes them uncomfortable, they would call the police. If the person is still there when the officer arrives, the officer has to witness the crime. Then we take down the person’s information, and the person who reported it has to sign a warrant.

In March, North Carolina passed a law, the Public Facilities Privacy and Security Act – known as HB2 or the ‘bathroom law’ – ending anti-discrimination protections for lesbians, gays and bisexuals. It also stopped transgender people from using public toilets that do not match the gender they were born with.

The legislation was introduced after the city of Charlotte passed its own bill in February to allow transgender people to use public toilets that correspond with their gender identity, rather than their gender at birth.

A federal challenge to North Carolina’s law has been filed by three people, backed by civil liberties groups, on the grounds that it is unconstitutional.

British student Maria Munir last week received praise for “coming out” as a non-binary person to President Barack Obama, during a question-and-answer session for youth leaders as part of his visit to the UK.

The 20-year-old said: “I’m about to do something terrifying which is coming out to you as a non-binary person.

“I’m from a Pakistani Muslim background which inevitably has cultural implications and I know that in North Carolina, people are having to produce birth certificates to go to the toilet.