In a large skillet, heat the olive oil over medium heat. Add the chopped onions and garlic, and sauté until golden brown and caramelized.
Add the chicken thighs to the skillet and cook until browned on all sides. Remove the chicken from the skillet and set aside.
In the same skillet, add the ground ginger, ground cinnamon, ground turmeric, ground black pepper, and saffron threads. Toast the spices for a minute or two to release their flavors.
Return the chicken to the skillet and add enough water to cover the chicken. Bring to a boil, then reduce the heat and let it simmer for about 45 minutes, or until the chicken is cooked through and tender.
Once the chicken is cooked, remove it from the skillet and shred it into small, bite-sized pieces. Return the shredded chicken to the skillet and mix it with the caramelized onions and spices. Stir in the chopped fresh cilantro, chopped fresh parsley, and chopped toasted almonds. Season with salt to taste.
Preheat your oven to 375°F (190°C). Grease a round baking dish with butter or cooking spray.
Take one sheet of phyllo pastry and brush it lightly with melted butter. Place another sheet on top and repeat the process until you have a stack of 5 sheets.
Carefully transfer the stack of phyllo pastry sheets to the greased baking dish, allowing the edges to hang over the sides.
Spoon the chicken filling onto the phyllo pastry in an even layer. Fold the overhanging pastry over the filling to encase it.
Repeat the layering process with another stack of 5 phyllo pastry sheets, brushing each sheet with melted butter. Place this second stack on top of the filling, tucking in the edges to seal the pastilla.
Brush the top of the pastilla with melted butter and sprinkle with powdered sugar and ground cinnamon.
Bake the pastilla in the preheated oven for 25-30 minutes, or until the pastry is golden and crispy.
Remove the pastilla from the oven and let it cool for a few minutes before transferring it to a serving platter.