A U.S. court ruled in favor of Colombia in a decades-long legal dispute over the ownership of pieces of a sunken galleon found in Colombian territorial waters 300 years ago.

The U.S. District Court for the District of Columbia ruled the Andean country does not have to pay $17 billion to Sea Search Armada, a U.S.-based salvage company. The company claimed the South American country breached a contract granting it the right to salvage Galleon San José, a British Navy ship that sank June 8, 1708, off the coast of Colombia.

The Spanish ship, which was trying to outrun a fleet of British warships, came loaded with more than 200 tons of gold, silver and emeralds when a mysterious explosion made it sink 700 feet below the surface, near the Rosario Islands. The treasure was owned by Peruvian and European merchants.

The Spanish galleon San José was trying to outrun a fleet of British warships off Colombia on June 8, 1708, when a mysterious explosion sent it to the bottom of the sea with gold, silver and emeralds owned by private Peruvian and European merchants, and lies about 700 feet below the water’s surface, a few miles from the historic Caribbean port of Cartagena, on the edge of the Continental Shelf.

Sea Search Armada said it found the shipwreck in the 1980s, and was given exclusive rights to claim 50 percent of what it found. Colombia later signed a decree – which eventually became law – giving the company a 5 percent “finders fee” – triggering Sea Search to sue Colombia for a larger share of its find.

The treasure is reportedly worth $4 billion to $17 billion.

“Without a doubt, the San José is the Holy Grail of treasure shipwrecks,” Robert Cembrola, director of the Naval War College Museum in Newport, R.I., said when the lawsuit was first filed.  

The San José is known to have been part of Spain’s only royal convoy take colonial gold to King Philip V during the War of Spanish Succession (1701–1714).

The ruling could also affect other commercial salvage companies eager to dive for more than 1,000 galleons and merchant ships believed to have sunk along Colombia's coral reefs during more than three centuries of colonial rule. Almost none has been recovered because of the legal limbo in the San Jose case.

The Colombian embassy in Washington said in a statement that "the decision is subject to appeal."

The Associated Press contributed to this report.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino