(CNN) Russian authorities must release the 24 Ukrainian sailors who were captured last year after entering the Kerch Strait, a United Nations maritime tribunal has ruled.

Ukraine said two of its small gunboats and one tugboat were attacked after entering the Kerch Strait en route to the city of Mariupol. Russia said the Ukrainian ships illegally entered Russia's territorial waters, carrying out dangerous maneuvers.

The UN International Tribunal for the Law of the Sea said Russia must release the sailors immediately and urged both nations to not escalate the conflict.

"The actions taken by the Russian Federation could irreparably prejudice the rights claimed by Ukraine to the immunity of its naval vessels and their servicemen," said Jin-Hyun Paik, the tribunal's president.

Read More