The UN's top court has ruled largely in favour of Somalia in its long-running dispute with Kenya over their maritime border.
Kenya rejected the ruling "in totality" before accusing the International Court of Justice of bias.
The case concerned a 38,000 sq mile (100,000 sq km) triangle in the Indian Ocean that is thought to be rich in oil and gas.
The dispute has been at the heart of a diplomatic row between the neighbours.
In a tweet, Somalia's Information Minister Osman Dubbe welcomed the ruling and congratulated Somalis on regaining their territory.
For the past four decades, Kenya has said its maritime border runs in a straight line east from where the two countries meet at the coast.
Somalia, however, argued in court that the sea frontier in the Indian Ocean should follow on in the same direction as their land border.
Somalia had also argued that Kenya had violated its sovereignty by operating in its territorial waters and demanded reparations.
The judges, however, rejected this argument.
The panel of 14 judges sitting in The Hague said that Kenya had not proved that Somalia had previously agreed to its claimed border.
Instead, they drew a new line which has split the disputed area in two.
Kenya has refused to recognise the ICJ's jurisdiction. And since the court has no means to enforce its rulings, it is unclear what will happen next.
In a statement, President Uhuru Kenyatta said the ruling would "strain the relations between the two countries".
In 2009, both nations agreed in a memorandum of understanding, backed by the UN, to settle the boundary dispute through negotiation.
But five years later, Somalia said the talks had failed and it went to the ICJ instead.
Before the judgment was delivered, Somalia's Deputy Prime Minister Mahdi Mohamed Guled told the BBC that his country "believes in the rules-based system... that's why we came to the court".
The court is supposed to be the final arbiter in disputes between nations.
Now that Kenya has rejected the ruling, the issue could be escalated to the UN Security Council, reports the BBC Anna Holligan from The Hague.
The stalemate continues
Analysis, by Ferdinand Omondi, BBC News, Nairobi
Neither country wanted this judgement, but Somalia is happier.
After all, it got a lot of what it claimed and Kenya did not want to give up anything at all.
Somalia's information minister captured the mood with his congratulatory tweet.
Meanwhile, Kenya's foreign ministry has told me it stands by last week's statement that it does not recognise the court's judgement.
Questions now centre on what next - and who can enforce the judgement?
Kenya has indicated that it is ready to go to war to defend its territory - a naval base near the disputed area was recently upgraded to a full military base.
Somalia has no navy. But it has friends.
Conflict however is not the first option.
Cue another round of talks, or a diplomatic showdown. Or both.
Kenya argued unsuccessfully that the ICJ should not be involved as the 2009 memorandum of understanding was binding.
Then in March it refused to take part in hearings after having asked for a delay to brief a new legal team.
It also objected to the presence on the ICJ panel of a Somali judge, saying he should recuse himself.
Last week, Kenya's government described the case as a "flawed judicial process". It added that there was "inherent bias" and that the court was an unsuitable way to resolve the dispute.