A federal judge dismissed a Roman Catholic pharmacist's claim that he was fired by Wal-Mart Stores Inc. for refusing to fill birth control prescriptions and that the dismissal violated his religious freedom.

The ruling Thursday said Wal-Mart had accommodated Neil Noesen's religious opposition to birth control by having other pharmacists fill prescriptions.

But U.S. District Judge John Shabaz said Noesen went too far by putting customers who called about birth control on hold indefinitely and by refusing to get service for those who showed up in person.

Noesen, 32, could not be located for comment Friday.

An attorney who represented Medical Staffing Network, the agency that placed him at the Wal-Mart store, said the ruling was among the first in the country to deal with religious accommodations for pharmacists.

"It demonstrates there has to be a balance between accommodating someone's religious beliefs while at the same time providing a service and allowing people access to medical care," attorney Stephanie Adler said.

Wal-Mart spokesman John Simley said the company was pleased with the ruling.

"These cases are rare, but when they do happen, we are careful to make accommodations. We also have a responsibility to customers to ensure that their prescriptions are filled," he said.

According to the judge's ruling, Noesen refused to leave the Wal-Mart store and eventually was dragged out in a wheelchair by police. He was convicted last month of resisting arrest but was acquitted on a disorderly conduct charge stemming from that incident.

Noesen also was sanctioned by the state Pharmacy Examining Board for refusing to fill a contraceptive prescription or transfer it while working at another store in 2002. The board reprimanded him and forced him to attend ethics classes.