Twenty-four people have gone on trial in Morocco on terrorism charges for the brutal slaying of two Scandinavian women hikers that shocked Denmark, Norway and Morocco itself.

The court decided to include the Moroccan government as a civil party to the case during Thursday's hearing in the coastal city of Sale.

Hafida Makssaoui, the government-appointed lawyer representing the four chief suspects, says the trial is expected to run for months.

She told The Associated Press that her clients, aged 25-30, have pleaded guilty and regret their actions. However she expects they will get a death sentence over the December attack on Louisa Vesterager Jespersen of Denmark and Maren Ueland of Norway.

The attackers shared a video of the killing on social networks and pledged allegiance to the Islamic State group.