South Dakota has passed a bill that will ban transgender people from using their preferred bathrooms.

The state senate – which debated the bill on Tuesday – passed it by 20 votes to 15 and will now send it to Republican Governor Dennis Daugaard, to be signed into law.

The legislation is the first to be passed in the US and will require transgender people to use facilities based on their “biological sex”.

Earlier this month, the state house passed the same bill 58 to 10, with sponsor Fred Deutsch saying it would protect “bodily privacy rights” of “biological boys and girls.”

A number of groups have already moved to slam the bill as being harmful.

This bill “causes actual harm to transgender students, an already vulnerable population,” ACLU South Dakota’s policy director Libby Skarin said.

“It singles out and targets them and attempts to isolate them, in a way that is really truly hurtful and discriminatory.”

However, others have come out in favour with Family Heritage Alliance Action spokesman, Dale Bartscher, saying the bill was the “right thing to do”.

He said: “It’s a privacy bill, it’s a modesty bill, it’s sensible South Dakota common sense.”

The bill states that if a student is given written consent from their parents, schools should make “reasonable accommodation” of single-occupancy restroom, a unisex restroom or controlled use of a restroom or locker room.

But adds that transgender students should not be allowed to use a bathroom, locker room or shower room that is used by other students and is different from their assigned gender.

A number of Democrats have criticised the bill as not being fully costed, could see federal funding being pulled and open the school districts up to law suits.

Since equal marriage was introduced across the United States last year, a number of states have taken action to subject the LGBT community to further discrimination.

Recently, a number of Republican US presidential candidates have stepped up their opposition to marriage equality, including Marco Rubio who launched a board full of prominent anti-gay activists.