The International Court of Justice has affirmed a decades-old treaty that granted Colombia three small islands in the Caribbean .