The German army crossed the Soviet frontier early in the morning on Sunday, 22 June 1941, on a broad front from the Baltic Sea to Hungary. The German army advanced quickly through Lithuania towards Daugavpils and other strategic points in Latvia. The Nazi police state included an organisation called the Security Service (German: Sicherheitsdienst), generally referred to as the SD, and its headquarters in Berlin was known as the National (or Reich) Security Main Office (Reichssicherheitshauptamt), known by its initial RSHA.
In advance of the invasion, the SD had organised four "Special Assignment Units", which have become known in history by their German name of Einsatzgruppen. The name of these units was a euphemism, as their real purpose was to kill large numbers of people whom the Nazis regarded as "undesirable". These included Communists, Gypsies, the mentally ill, and especially, Jews. The Einsatzgruppen followed closely behind the German invasion forces, and established a presence in Latvia within days, and sometimes hours, of the occupation of a given area of the country by the German Wehrmacht.
The SD in Latvia can be distinguished in photographs and descriptions by their uniforms. The full black of the Nazi SS was seldom worn, instead the usual attire was the grey Wehrmacht uniform with black accents. They wore the SD patch on the left sleeve, a yellowish shirt, and the Death's Head (Totenkopf) symbol on their caps. The SD ranks were identical to the SS. The SD did not wear the SS lightning rune symbol on their right collar tabs, but replaced it with either the Totenkopf or the letters "SD".
The SD first established its power in Latvia through Einsatzgruppe A, which was subdivided into units called Einsatzkommandos 1a, 1b, 2 and 3. As the front line moved further east, Einsatzgruppe A moved out of Latvia, remaining in the country only a few weeks, after which its functions were taken over by the "resident" SD, under the authority of the Kommandant der Sicherheitspolizei un SD, generally referred to by the German initials of KdS. The KdS took orders both from RSHA in Berlin and from another official called the Befehlshaber (commander) der Sicherheitspolizei und des SD, or BdS. Both the KdS and the BdS were subordinate to another official called the Ranking (or Higher) SS and Police Commander (Höherer SS-und Polizeiführer), or HPSSF. The lines of authority were overlapping and ambiguous. The eastern part of Latvia, including Daugavpils and the Latgale region, was assigned to Einsatzkommandos 1b (EK 1b) and 3 (EK 3). EK 1b had about 50 to 60 men and was commanded by Erich Ehrlinger.
In Latvia, the Holocaust started on the night of 23 to 24 June 1941, when in the Grobiņa cemetery SD murderers killed six local Jews, including the town chemist. On the following days 35 Jews were exterminated in Durbe, Priekule and Asīte. On June 29 the Nazi invaders started forming the first Latvian SD auxiliary unit in Jelgava. Mārtiņš Vagulāns, member of the Pērkonkrusts organisation, was chosen to head it. In the summer of 1941, 300 men in the unit took part in the extermination of about 2000 Jews in Jelgava and other places in Zemgale. The killing was supervised by the officers of the German SD Rudolf Batz and Alfred Becu, who involved the SS people of the Einsatzgruppe in the action. The main Jelgava Synagogue was burnt down through their joint effort. After the invasion of Riga, Walter Stahlecker, assisted by the members of Pērkonkrusts and other local collaborationists, organised the pogrom of Jews in the capital of Latvia. Viktors Arājs, aged 31 at the time, possible former member of Pērkonkrusts and a member of a student fraternity, was appointed direct executor of the action. He was an idle eternal student who was supported by his wife, a rich shop owner, who was ten years older than he was. Arājs had worked in the Latvian Police for a certain period of time. He stood out with his power-hungry and extreme thinking. The man was well fed, well dressed, and "with his student's hat proudly cocked on one ear".