In a key courtroom victory for the pharmaceutical industry, health-care-data companies have won the right to continue gathering prescription data and using it to target physicians in sales pitches.

A federal judge in New Hampshire, ruling late Monday, struck down that state's 2006 ban on prescription data-mining, saying the ban violated commercial free speech.

While applying only to New Hampshire, the ban was being watched closely as the first nationwide. Legislators in a dozen other states - not including Pennsylvania or New Jersey - have been weighing bills with similar effect, though none has passed.

Two Philadelphia-area health-care-data companies, IMS Health Inc. and Verispan L.L.C., had challenged New Hampshire's law as an illegal infringement on their business.

"We are very pleased with the judge's decision, and there are no losers in the outcome of this trial," Robert H. Steinfeld, senior vice president and general counsel of IMS, said in a statement signed by both companies.

Responding to the defeat, New Hampshire Attorney General Kelly Ayotte said: "We're reviewing the decision, and we'll decide whether to appeal," according to the Associated Press.

Critics of the practice expressed disappointment, but said the ruling did not necessarily dash their hopes of curtailing the practice.

"State legislators will look carefully at this ruling and will try to craft legislation that is constitutional," said Sharon Anglin Treat, a Maine legislator and sponsor of a data-mining bill. She also serves as director of the National Legislative Association on Prescription Drug Prices.

The judge's ruling means IMS, Verispan and other data companies can continue their long-standing practice of buying sales data from pharmacies, matching it with data on individual prescribers, then reselling the refined information to drug companies.

Drug companies use the data to tailor sales pitches toward individual prescribers, such as identifying early adopters vs. skeptics of new products. Sales representatives often are ordered to keep the information confidential from doctors.

Patient information is not included in the data.

IMS, based in Stamford, Conn., conducts much of its prescription-data gathering and analysis work at its 1,700-employee office in Plymouth Meeting.

Verispan, which employs about 500 people, is based in Yardley.

The New Hampshire law was billed as a way to control drug costs by limiting sales pitches that its supporters say drive up prices. It said companies could not use data for targeting physicians, but did allow collection of prescribers' zip codes, location and medical specialties for use in patient-care management, clinical trials, and education.

In his ruling, U.S. District Judge Paul Barbadoro accepted the state's right to control costs, but said the ban failed to do so. It "restricts constitutionally protected speech without directly serving the state's substantial interests," he wrote.

He said "alternatives exist that would achieve the state's interests as well or better without restricting speech."

In a statement, the industry's leading trade and lobby group, Pharmaceutical Research and Manufacturers of America, said the judge concluded that "the remedy to improving prescribing decisions is more information, not enforced silence. We couldn't agree more."

Last year, the American Medical Association, with support from IMS and Verispan, created an opt-out system for physicians to remove their names from monitoring.

But as of this month, only 7,200 physicians have opted out of the AMA database from which the data is compiled. The database contains about one million names, said AMA spokesman Robert Mills.

The AMA has not taken a formal position on the ban. It reported receiving $44.5 million in 2005 from data companies for use of its database.

The news lifted IMS's share price $2.38, or more than 8 percent, to $31.71.

Contact staff writer Thomas Ginsberg at 215-854-4177 or tginsberg@phillynews.com.