GEORGETOWN, Del. (Reuters) - Williams Cos Inc (>> Williams Companies Inc) and Energy Transfer Equity LP (>> Energy Transfer Equity LP) sparred in court on Monday over a tax dispute that threatens to scuttle their $20 billion merger just one week before Williams shareholders vote on the deal to create one of the world’s largest pipeline companies.

The two companies are suing each other as Energy Transfer Equity, or ETE, looks for a way to back out of the deal amid falling energy prices and a volatile financial market. The deal was agreed upon last September and originally valued at around $33 billion.

Williams is asking a judge to force ETE to complete the takeover, alleging that the company and its chief executive, Dallas billionaire Kelcy Warren, have purposely worked to scrap the merger.

ETE has countersued, arguing that Williams has breached the agreement, in part by misrepresenting the level of its board's support for the deal.

The two-day trial kicked off in Delaware's Court of Chancery before Vice Chancellor Sam Glasscock on Monday.

Much of the day's testimony centered on the apparent discovery in March by the head of tax at ETE that the deal structure would trigger a big potential tax, something that had gone unnoticed previously.

Williams' legal team tried to show the tax issue was concocted by ETE as a last-ditch effort to back out of a deal that otherwise was relatively air-tight.

The company’s attorneys showed a video of testimony from Jamie Welch, Energy Transfer’s former chief financial officer, who was fired in February. Welch said Warren had raised concerns about the deal as early as January, saying it could trigger credit downgrades and an “implosion” of the company.

Welch said Warren called his management team and lawyers together in January to review his rights for ending the deal, and also tried to reach a settlement with Williams.

"He feared for the future of the Energy Transfer enterprise if the deal with Williams had to close on its current terms," Welch said in the video played in court.

Weeks later, Brad Whitehurst, the head of tax at ETE, uncovered the tax problem.

Whitehurst and a tax attorney for Latham & Watkins, the firm hired to review the deal’s tax treatment, described how everyone had overlooked the impact of a falling ETE share price on the tax impact of the deal.

"It’s your worst nightmare," Whitehurst told the court about his discovery that the deal structure would cause a big tax hit. "Your heart stops. You panic."

BUYER'S REMORSE

The trial comes just days before a scheduled June 27 vote by Williams shareholders on whether they want to accept the deal.

While the acquisition was long-sought by Warren, Williams said the ETE chief executive soon came down with buyer's remorse and began to search for a way out as a slump in energy prices deepened.

ETE has made clear it believes the deal is no longer attractive. It has slashed estimates for expected cost savings and said it would likely have to cut distributions to shareholders entirely next year if it has to complete the deal.

Williams' legal team tried to show a split among ETE’s advisers, with their deal lawyers at Wachtell, Lipton, Rosen & Katz privately agreeing with a suggested solution to the tax problem proposed by Williams’ lawyers at Cravath Swaine & Moore.

Minh Van Ngo, a corporate lawyer with Cravath, told the court that Wachtell lawyers said they were prevented by ETE from reviewing the tax issue. "I always found it incredibly odd Wachtell was not involved in finding a solution," said Van Ngo.

(Additional reporting by Michael Erman in New York; Editing by Matthew Lewis)

By Tom Hals

Stocks treated in this article : Energy Transfer Equity LP, Williams Companies Inc