Ending a case that came before the International Court of Justice in 1999, the ruling rejects Nicaragua's claim to the islands but extends the country's offshore territory.

BOGOTA, Colombia — In a ruling that gave each side some of what it wanted, the International Court of Justice in The Hague on Monday upheld Colombia's sovereignty over seven Caribbean islands but ordered that Nicaragua's maritime boundary be redrawn to give it more offshore territory.

Ending a case that first came before the court in 1999, the ruling gives Nicaragua additional access to fishing grounds and potentially huge reserves of natural gas that Colombian government studies say reside below the ocean floor in the disputed area.

In a reading broadcast over Colombian television, the court in the Netherlands announced that Colombia had adequately "shown its right to the archipelago," which includes the islands of Roncador, Quitasueno, Serrana, Serranilla, Bajo Nuevo, Cayo Bolivar and Albuquerque, turning down the Nicaraguan petition that they revert to its control.

But the judges found that Nicaragua's eastern maritime boundary should be extended several miles in a jagged diagonal line east of the current limit, the 82nd meridian, producing a significant gain in offshore territory.

"We are very satisfied," said Nicaraguan attorney Carlos Arguello in The Hague, deferring further comment to President Daniel Ortega.

The Colombian reaction was more subdued. Chief attorney Julio Londono Paredes hailed the retention of the islands but added that he would have to study the redrawn maritime map before his government commented on that aspect.

The slow-moving case saw the court issue a preliminary ruling in 2007 confirming Colombian control over the disputed archipelago's main islands, San Andres and Providencia. But it left the issue of 12,000 square miles of maritime territory and seven smaller islands in abeyance until Monday.

Although the ruling upholds Colombia's control over all the islands and a 12-mile radius around each, it expanded Nicaragua's territory significantly, although the exact number of square miles gained by Nicaragua was not immediately specified.

Enrique Serrano Lopez, an international relations professor at Bogota's Rosario University, described the ruling as "Solomonic," applying opposing criteria in territorial disputes: treaties agreed to in the past versus modern concepts of what constitutes equitable division of territory.

Nicaragua signed a treaty in 1928 agreeing to Colombia's territorial claims, even though the islands lie about 400 miles or more northwest of Colombia but only about 100 miles at the closest point off Nicaragua's Caribbean shore. Nicaragua subsequently claimed the 1928 treaty was invalid because it was signed under the duress of a U.S. military occupation.

"There was reason to be pessimistic that Colombia would retain all the maritime territory," Serrano said. "The importance in modern times of ocean subsurface for energy exploration, the fact the disputed area is much closer to Central America, and that Nicaragua is a little country going up against a bigger one in some ways made the dispute problematic for Colombia."

Colombia has exercised sovereignty over the islands and territory east of the 82nd meridian since its independence in 1819. Its claims were based on an edict signed in 1803 by the Spanish king, who included them in territory allotted to the then-colony of Nuevo Granada, now Colombia.

Colombian fishermen on San Andres interviewed by Caracol TV after the ruling said they were worried that the redrawing of territorial limits had created "enclaves" around Quitasueno and Serrano that could restrict the fishermen's longtime access there.