Massachusetts Attorney General Martha Coakley says her office has settled a lawsuit against a health insurance company and several subsidiaries.

The $17 million agreement is believed to be the largest consumer protection settlement against a health plan in Massachusetts history, according to Coakley’s office.

The lawsuit charged HealthMarkets Inc., North Richland Hills, Texas, and subsidiaries MEGA Life and Health Insurance and Mid-West National Life Insurance with unfair and deceptive practices in marketing and administering limited-benefit health plans sold to small businesses and individuals in the state.

The carriers targeted the self-employed along with small business owners in Massachusetts with products packaged as part of memberships in the National Association for the Self Employed, Washington; Americans for Financial Security, Irving, Texas; and the Alliance for Affordable Services, Dallas, according to Coakley.

“These companies used unfair and deceptive marketing and other practices to convince Massachusetts residents to buy health plans with limited benefits,” Coakley said in a statement. “Massachusetts health care consumers must be fairly told what they are buying, and their premium dollars should be used predominantly to pay health care benefits and not inflated commissions, overhead and profits.”

Under the terms of the consent judgment filed Monday in Suffolk Superior Court in Massachusetts, the companies will pay more than $17 million in consumer relief, penalties and costs.

In addition, the companies will be banned for at least 5 years from selling their health plans in Massachusetts and are required to exit the health plan business completely in the state. They are allowed to renew existing health plans with individuals and small businesses through 2012, while giving current policyholders time to obtain other coverage if they wish to do so.

The settlement further bars a number of unfair and deceptive acts and practices that were subjects of the lawsuit, including deceptive advertising, predatory sales practices, failing to provide health benefits required under state law, disclosing consumers’ personal information to third parties, and illegally requiring individuals and small businesses to join associations to gain access to health plans.

The insurers cooperated with her office in reaching the settlement, Coakley said.

Under the terms of the judgment, the companies agreed to pay $11.25 million for consumer relief, $2.1 million in consumer relief–an amount that has already been paid–$3 million in civil penalties, and $750,000 in costs, including attorneys’ fees.

The consumer relief funds will be used to aid Massachusetts policyholders whose claims for certain benefits mandated by Massachusetts law, such as maternity health care, were denied based on purported lack of coverage. Other policyholder claims were denied based on illegal pre-existing condition exclusions or waiting periods, according to the Attorney General’s office.

The Attorney General first filed suit against the defendants in October 2006, then filed an amended complaint in August 2007, expanding upon the charges in the initial suit.

In a statement, HealthMarkets Inc. announced that its subsidiary insurance companies will focus solely on marketing its ancillary vision, dental and related specialty plans in Massachusetts and discontinue marketing other health insurance products in the state after Sept. 30.

“The company worked with the offices of the Massachusetts Division of Insurance Commissioner and the Massachusetts Attorney General to resolve all matters related to regulatory issues with the Division of Insurance dating back to 2003, and to litigation brought by the Attorney General’s office dating back to 2004,” HealthMarkets stated.

This decision has no impact on the company’s marketing efforts outside of Massachusetts, the company noted..

HealthMarkets says its subsidiaries have approximately 27,000 health insurance members in Massachusetts.

The company also stated that it has a new management team “committed to ensuring that it complies with the agreements with the Massachusetts Attorney General and the Massachusetts Division of Insurance.”