OAKLAND (CBS SF) — Women who are booked into Alameda County jails will no longer automatically be required to take pregnancy tests, as a result of a civil-rights-lawsuit settlement announced Wednesday.

Instead, they will be given the option of whether they want to take a pregnancy test, unless there is a court order or an emergency in which the woman is incapable of giving consent to the test.

READ MORE: Homebuyers In Northern California 'High Fire Zones' See Insurance Rates Go Through The Roof

The agreement was announced by the American Civil Liberties Union of Northern California, whose lawyers represented three women who sued Alameda County Sheriff Gregory Ahern over the policy in Alameda County Superior Court in Oakland last year.

The lawsuit was later moved to federal court.

One of the women, Susan Harmon, was 69 years old when she was required to give a urine sample for a pregnancy test at the Glenn E. Dyer Detention Facility in Oakland in 2010 after she was arrested during a protest of the fatal shooting of Oscar Grant by a BART officer.

Harmon said in the lawsuit that she told officers she could not possibly be pregnant and was “humiliated and demeaned” by the forced testing.  She was released the next morning, was not charged with any crime and was never told the test result, the suit said.

Harmon and the other two women claimed the testing violated their California constitutional right to privacy and their state and federal rights to be free of unreasonable searches and seizures.

Another plaintiff, who was arrested during a political demonstration in Oakland in 2012, said she felt “deeply distressed” and had her privacy invaded by the testing because she had been unsuccessful in trying to conceive and knew she was not pregnant.

READ MORE: COVID: Mask Uncertainty Reigns As Bay Area Health Officials Push To Loosen Guidelines

The lawsuit said that as of 2014, the Sheriff’s Department policy for the Glenn Dyer facility and Santa Rita Jail was that “All female inmates under 60 years of age are tested to determine pregnancy at intake using a urine test or other means of testing.”

Under the settlement, women will be told they have the option to take a test, unless there is a judge’s order or an emergency, and the tests will be administered only by medical personnel.

Nurses or other medical staff will ask women under the age of 56, “We’d like you to take a pregnancy test so you can get the most appropriate care. Is that okay with you?”

Harmon said in a statement, “I am pleased that Alameda County is changing its practices to better support women. Pregnancy testing may be useful and should be offered, but it should always be up to the individual.”

The settlement states that the sheriff believes the previous policy was legal, but wanted to resolve the lawsuit.

Sheriff’s Department spokesman Sgt. J. D. Nelson said the former policy of testing all women under 60 grew out of a recommendation in a settlement of an earlier lawsuit filed in the 1980s that alleged there was inadequate prenatal care of women booked into the jails.

“Now after 30 years there is another thought process. We will adjust,” Nelson said.

MORE NEWS: UPDATE: Crews Contain Grass Fire Burning Near Bay Shoreline In San Rafael

© Copyright 2015 by CBS San Francisco and Bay City News Service. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.