The United Nations' highest court has ruled that Nicaragua violated Costa Rica's territorial sovereignty by establishing a military base and digging channels on a small chunk of land near the mouth of the San Juan River, and ordered Managua to pay compensation.

Wednesday's ruling by the International Court of Justice establishes that Costa Rica owns a three-square-kilometer (1.2-square-mile) piece of land near the shores of the Caribbean Sea that had been at dispute between the Latin American neighbors.

The ruling addressed complaints by both countries about construction work near the remote mouth of the river — channels dug by Nicaragua and a road along the river bank built by Costa Rica.

The world court says the countries should establish how much compensation Nicaragua must pay for "material damages."