In the face of a legal challenge, Massachusetts officials withdrew a regulation that tried to steer subsidies for renewable power to Massachusetts-based companies.

The emergency order issued by the state Department of Public Utilities on Wednesday means Massachusetts renewable energy developers will now have to compete against companies outside the state for long-term power contracts being offered by Bay State utilities. The order was a setback for the Patrick administration, which is trying to build a clean tech industry in Massachusetts.

The order was issued in response to a lawsuit filed by TransCanada, a Canadian-based energy company that owns a wind farm in Maine and sells electricity in Massachusetts. TransCanada sued state officials last month, alleging their efforts to steer renewable energy subsidies to Massachusetts companies violated the interstate commerce clause of the US Constitution. Company officials also warned that the Massachusetts-only provision would saddle Bay State utility customers with higher rates than they should be paying.

Most of the money being paid by Massachusetts utility customers to subsidize renewable power is flowing out of state. According to a 2007 state report, the latest available, only 11 percent of the Massachusetts subsidy money is flowing to Bay State projects. The rest is going to Maine (32 percent), New York (17 percent), New Hampshire (16 percent), and Canada (13 percent), with lesser amounts to Vermont, Connecticut, and Rhode Island.

State officials tried to give a boost to Massachusetts projects by steering a portion of solar subsidies to Massachusetts companies and also requiring that utilities attempt to negotiate long-term contracts with Bay State firms. Under the latter provision, National Grid proposed a 15-year, $3 billion contract for half of the power generated by Cape Wind. National Grid estimates it will pay 42 percent more for Cape Wind power over the life of the contract than if it purchased power from conventional sources.

Industry officials say renewable power is available in Maine at far less cost, but Ron Gerwatowski, deputy general counsel at National Grid, said the utility believes the Cape Wind contract is needed if the region is going to meet its goals for developing renewable power.

“There’s no other large-scale project out there ready to go,” he said, adding that the DPU decision will have no impact on the company’s Cape Wind proposal.

When state officials negotiated a partial settlement  recently with TransCanada on the solar subsidies, Ian Bowles, the state’s secretary of energy and the environment, said he was confident the state would prevail on its long-term contracts provision in court. Yesterday, Robert Keough, a top aide, said the DPU issued its order to avoid a lengthy court battle.

“The DPU has ordered the utilities to entertain proposals from eligible out-of-state renewable energy developers along with those received from Massachusetts-based projects,” he said in a statement.