By Laura Sheeter
BBC News, Riga
Latvia and Russia have signed a border treaty, making the boundary between the countries official for the first time since the fall of Soviet Union in 1991.
Aigars Kalvitis (L) and Mikhail Fradkov signed the deal in Moscow
The treaty was signed in Moscow by the Latvian and Russian prime ministers.
The treaty was drawn up 10 years ago, but both nations had previously failed to ratify it because of disagreements about the Soviet past.
It is hoped that the signing of the agreement will now lead to a warming in Latvian-Russian relations.
Ties between the countries have rarely been more than frosty since the collapse of the Soviet Union.
Previous attempts to sign the treaty had failed because of disagreement over whether Latvia was occupied by the Soviet Union or - as Russia says - joined voluntarily in 1940.
There has also been considerable opposition to the agreement within Latvia because the post-Soviet border differs from the pre-Soviet one, turning a small piece of what was Latvia into Russian soil.
Although Latvia has never demanded the territory back, many here believe that formalising the border is tantamount to officially approving the Soviet occupation of their country.
Those supporting the deal have said Latvia should leave the past behind - especially now that the country is in the European Union, and this border is the EU's border with Russia too.
After the signing ceremony, Latvian Prime Minister Aigars Kalvitis said he hoped the treaty would open the way for more active economic and political dialogue between the two countries.
Russian Prime Minister Mikhail Fradkov was cautious in welcoming the agreement, saying that it would not automatically solve all the problems that had developed between them in the past 16 years.