Announcing government support for clean-energy projects, President Obama hailed a Spanish company, saying its new solar technology would supply tens of thousands of American homes with renewable power, while spurring local employment.

“It’s good news,” Mr. Obama said in 2010, “that we’ve attracted a company to our shores to build a plant and create jobs right here in America.”

Since then, the Spanish company, Abengoa, has built two American plants, in Arizona and California, supplying electricity to more than 160,000 homes. It is the world leader in a technology known as solar thermal, with operations from Algeria to Latin America.

But Abengoa’s global ambitions are now the source of its troubles.

Saddled with debt from its expansion, the company is scrambling to avoid what would be the largest bankruptcy in Spanish corporate history. Creditors and shareholders are taking the company to court as losses mount and crucial financial support disappears.