Those volcanic islands, 720 kilometers (450 miles) from Colombia's coast and 110 kilometers (70 miles) from Nicaragua's mainland, are popular among tourists for their pristine white beaches and coral reefs.
In Monday's ruling, the court's 15 judges said that several other smaller islands and cays in the region also belong to Colombia and set the maritime borders based on Colombia's ownership of the islands.
The new borders give Colombia control of the waters and seabed immediately surrounding its islands and cays but also give Nicaragua a large horseshoe-shaped area of the sea and seabed stretching from its mainland coast around the Colombian islands.
The provincial governor of San Andres, Auri Guerrero, told The Associated Press it was important that the court ruled that the waters immediately surrounding two outlying keys, Quitasueno and Serrana, are Colombian territory as they are extremely important for many of the 1,200 small fishermen who live in the archipelago.
But "a boundary has been set where we end up losing territorial water in San Andres province. In the end, we can't be happy or satisfied with the ruling." Two other keys, Serranilla and Bajo Nuevo, were similarly separated.
There are also two commercial fishing companies in the islands, which have 72,000 inhabitants, said Guerrero.
The islands were first settled by Puritans in the early 17th century, and later used as an outpost by pirates. Many inhabitants today are descendants of slaves who speak English as their first language.
Nicaragua had argued that when it ceded the archipelago to Colombia in a 1928 treaty, it did so under duress because Nicaragua was then occupied by U.S. Marines who were battling a leftist insurrection.
The territorial dispute prompted the Colombian military to step up its presence near the archipelago. Nicaragua's government accused Colombia's navy of intercepting and capturing Nicaraguan fishing boats off the Nicaraguan coast.
Luis Manuel Galeano in Managua, Nicaragua, Vivian Sequera and Cesar Garcia in Bogota, Colombia, and Frank Bajak in Lima, Peru, contributed to this report.
Cut pounds of stomach fat every week by using this 1 weird old tip.