TAMPA, Fla. (AP) _ The U.S. Navy has ended a lengthy dispute with American Ship Building Co. by agreeing to pay $18 million to the shipyard, whose largest shareholder is New York Yankees owner George Steinbrenner.

U.S. Bankruptcy Court Judge Thomas Baynes approved the settlement Thursday, saying it would bring badly needed cash to the troubled firm and put it in a position to operate more efficiently.

Pentagon auditors determined that the Navy owed $27 million to the company for work on three ships, American Ship Building attorney Bob Banker said.

While the Navy disagreed, the company determined that bringing a lawsuit to trial could have taken up to five years and would have cost millions of dollars needed to pay creditors, Banker said.

In accepting the settlement, the Tampa shipyard ended a battle with the Navy that started when it won a 1989 contract to complete two oiler ships.

Complaining the company was behind schedule and lacked the money to pay suppliers, the Navy withheld payments and then canceled the contract in 1993. It also threatened to scrap a $60 million contract for an intelligence ship.

American Ship Building, which sought federal bankruptcy court protection in November 1993, filed a lawsuit against the Navy seeking $45 million.

Under the settlement approved Thursday, the Navy will pay the company $16.9 million and release $1.1 million held in an escrow account for suppliers. American Ship Building agreed to give the contract for the intelligence ship, which is in pieces at its Port of Tampa yard, to a Louisiana shipbuilder.

American Ship Building came out of bankruptcy last October.