PHOENIX — Arizona cannot cut Planned Parenthood out of its Medicaid program simply because the organization also provides abortions paid for with other funds, a federal appeals court ruled Thursday.

The 9th U.S. Circuit Court of Appeals said Arizona lawmakers acted illegally last year in tying the Medicaid funding for family-planning services to a requirement for Planned Parenthood to stop doing abortions. The judges, in a 32-page ruling, said legislators acted contrary to federal law.

Thursday’s ruling affirms a trial court’s earlier decision.

Attorney Steven Aden of the Alliance Defending Freedom, which asked the court to uphold the law on behalf of the state, said his organization is weighing future legal options.

In the meantime, Planned Parenthood continues to receive federal and state funds.

State and federal laws already bar public funds from being used for elective abortions. Instead, Planned Parenthood gets Medicaid money — about 90 percent of it from the federal government — to cover everything from gynecological exams to contraceptive counseling.

But state Rep. Justin Olson, R-Mesa, contends any funds Planned Parenthood receives for those services underwrite the fixed costs of keeping the doors open, which has the effect of state money subsidizing abortions.

His legislation, approved last year and signed by Gov. Jan Brewer, says any or-

ganization  that provides abortions is ineligible for Medicaid funding. Planned Parenthood responded to HB 2800 by filing suit.

Judge Marsha Berzon, writing for the unanimous three-judge panel, did not address the question of whether  Medicaid funds were subsidizing abortions.

Instead, she said, the issue comes down to a simple fact: Federal law allows those enrolled in Medicaid — and that includes the Arizona Health Care Cost Containment System — to get the services from any qualified provider.

Aden and attorneys for the state conceded that point, but argued that lawmakers are free to decide who is “qualified.’’

They said legislators are free to conclude Planned Parenthood is not “qualified” to provide family-planning services because it also provides abortions, a position Berzon said has “fatal flaws.’’

Perhaps the most glaring is that the claim ignores the rest of the words in federal law, which says Medicaid recipients can get care from any provider “qualified to perform the service or services required.” And Berzon said the state is not making that argument.

Berzon derided Aden’s contention that states are free to define who is “qualified.”

She said if the court were to accept Arizona’s argument that abortion providers are not qualified, then another state could contend that only doctors who do perform abortions are entitled to Medicaid funding. Similarly, it would open the door to letting states decide that Medicaid services could be provided only by osteopaths, nonsmokers or affiliates of the state’s medical school “on the grounds that only doctors within that category are worthy of receiving Medicaid funds.”

Berzon said there are areas where an otherwise medically qualified physician or health-care provider can be determined to be unqualified. But she said that is limited to things like fraud, patient abuse, criminal activity and improper billing.