A court in Rabat, Morocco, handed down death sentences on Thursday to three men who attacked and beheaded two young Scandinavian women as they camped out in the Atlas Mountains last December. The three, Abdessamad Ejjoud, 25; Younes Ouaziyad, 27; and Rachid Afatti, 33, filmed the attack on a cellphone. The victims were 24-year-old Louisa Vesterager Jespersen of Denmark, and 28-year-old Maren Ueland of Norway. The attackers said they had stalked the victims after deciding that other hikers, who were traveling with guides, might be more difficult targets. The women were traveling alone. The condemned men said they carried out the attack on behalf of Islamic State, although ISIS, in an unusual departure from the enthusiastic support it usually voices for local violence initiated by supporters, distanced itself from the men and their deeds. A fourth man, a European convert to Islam, was given 20 years for having instructed the three in the use of weapons and cellphone encryption. In all, some two dozen people were tried in connection with the killings.