Chile's Supreme Court has ruled in favour of a multi-billion dollar dam project in Patagonia, in the south of the country.
The court, the highest in the land, rejected an appeal by environmentalist groups who fear it will damage Patagonia's fragile ecosystem.
The project, which involves flooding 6,000 hectares (15,000 acres) of land, still needs government approval.
It has sparked a number of protests, some of them violent.
Court spokesman Jaime Rodriguez said the Supreme Court had rejected seven appeals filed against the HidroAysen project, a joint venture by Spanish-owned energy company Endesa and Chile's Colbun.
The objections ranged from the detrimental effect opponents said it would have on the Laguna San Rafael National Park to the dangers it could pose to the Huemul, an endangered Andean species of the deer family.
The project would involve the building of five dams on two fast-flowing rivers that run into the Pacific - two on the river Baker, and three on the river Pascua.
They would drain lakes in a region that is famous for its rugged beauty - a landscape of glaciers, ice-fields, mountains and fjords.
The government says the dams are essential to meet Chile's growing energy needs.
The Supreme Court decision follows a ruling in October 2011 by a lower court, which had also found in favour of the project.
Environmentalists appealed against that decision, taking it to the Supreme Court.
Wednesday's ruling was the last legal hurdle in the way of the project, which would see two major rivers dammed and five power stations built.
The project will, however, still need government approval for the building of a 2,000km-long (1,250 mile-long) transmission line channelling power to the capital, Santiago.
If the government gives its go-ahead to the transmission line, construction work on the project could begin in 2014, and is expected to take around 10 years.
HidroAysen says the project "represents a cost-effective, sustainable, reliable and ecologically viable source of energy".