Few points to remember.
People today get so caught up in the Heroic Defence Of The Soviet Motherland Against The Invading Fascist Monsters that they lose sight of the fact that Russia has, over the last several centuries, almost always been the invader rather than the invaded. This historical process continues to this day, if you examine things carefully enough.
The "X" marking on captured equipment was actually crossed Moisin-Nagant rifles, if you look at it carefully. I have it on a Luger here. It was applied to captured equipment which entered Soviet Service.
Latvia was an independent country from 1918 to 1940, having spent some centuries previous as an occupied country. In the late Middle Ages Latvia was an important and powerful country. It descends from the Hanseatic League states and the people are to a great extent descended from German settlers, many of whom moved in in pre-Hanseatic times and stayed.
The Soviet Union 'protected' Latvia in 1940 by the simple expedient of invading it and turning it into another state in the Soviet system. When the Germans invaded in 1941, they were regarded a liberators in Latvia, Lithuania and Estonia as well as in modern Moldova, Belarus and Ukraine. In Ukraine, the Germans discovered entire towns where the people spoke a better grade of German than the German invaders. Relations between the German occupying authorities an the locals often were much better than generally supposed, especially in the Baltic States which shared MUCH common history and culture with Germany, very little indeed with Russia.
I think the logical chain with regard to this rifle would be:
built for Soviet service
captured by the Nasties
given to Fire Service in Mittau (old spelling of Mitau)
recaptured by Sovs when they pushed back through the Baltic States and put into Soviet service once again
factory refurbed by Soviets
surplused
When the Sovs retook the poor Baltic States, they embarked on a planned program of Russification, including massive involuntary population transfers, which accounts for the minorities of ethnic Russians living in these countries today. Before 1940 they were true National States for the Latvian, Lithuanian and Estonian people who descended from Hanseatic Germans.
This is not all old history from books. Look at a map some time. The "Russian" city of Kaliningrad was created post-1945 by evicting all the Germans and replacing them with ethnic Russians. I'll betcha anything you like that the local newspaper no longer uses Fraktur type and no longer calls itself the "Konigsberger Zeitung" as once it did. Yes, this is the Imperial German city of Konigsberg, for which the famed warships were named.
.