THE MASSACHUSETTS CLEAN ENERGY CENTER paid two outside law firms $2.3 million to defend it in a lawsuit the agency eventually lost and ultimately settled for $20.8 million.

Both the settlement and the litigation costs have exacerbated the center’s shaky financial situation, which has prompted soul-searching within the agency and the hiring of Gov. Charlie Baker’s former chief of staff to help develop a strategy for the future.

The Clean Energy Center is charged with growing the state’s clean energy economy. It has been spending millions of dollars more every year than it takes in from the Revenue Trust Fund, which was established in 1998 as part of the deregulation of the electric utility industry. The money in the Revenue Trust Fund comes from assessments on customer utility bills in Massachusetts.

The lawsuit stemmed from work related to the 28-acre, $113 million New Bedford Marine Commerce Terminal, a staging site for offshore wind development that has yet to take off. Two contractors on the project sued the Clean Energy Center, alleging the agency misrepresented the amount of work necessary to dredge the harbor to make way for the terminal. The Clean Energy Center insisted the foul-up was the fault of the contractors.

Although the trial lasted several weeks, the jury reached a verdict in just one day in favor of the contractors, awarding them $21.3 million. For months, the Clean Energy Center contemplated filing an appeal, but eventually decided to settle for $20.8 million in February. That amount plus the legal fees paid to the law firms Verrill Dana and Holland & Knight represent three quarters of the center’s projected revenue in the current fiscal year.

Amid its deteriorating financial situation, the Clean Energy Center awarded a no-bid contract last November to Steven Kadish, Baker’s former chief of staff, agreeing to pay him $2,000 a day to “produce a working strategic direction document” that the center can use to guide it for the next five to ten years.  The contract is capped at $49,000.   As of last month, there was $13,000 left on it.

Kadish declined a request for an interview and referred questions to the Clean Energy Center. Stephen Pike, the CEO of the center, who is paid $195,000 a year, declined comment.