Halve the lime and squeeze it. Peel garlic and chop finely. Wash the rosemary and dab dry. Pluck needles and chop finely.
Wash the legs and pat dry. Cut the skin on the underside and remove the meat with your fingers. Cut the legs into upper and lower legs with a sharp knife or poultry shears.
Put chicken pieces in a bowl. Mix with lime juice, garlic, rosemary and 1⁄4 TL pepper. Leave covered in the fridge for about 1 hour.
Onions peel and chop finely. Heat the oil in a frying pan or casserole. Fry the onions until they are dark brown, almost burnt. Melt 2 tablespoons of butter in it. Add chicken legs immediately and fry well all around.
Season with salt. Add the rest of the marinade or a few tablespoons of water. Cover and braise for about 40 minutes, turning the chicken parts halfway through the cooking time and possibly adding some more water.
In the meantime, peel, wash and coarsely dice the sweet potatoes for the puree. Cover and cook in salted water for about 30 minutes. Drain and add 4 tablespoons of butter. Mash with a potato masher until puree.
Season to taste with salt and pepper. Arrange chicken with onion sauce and sweet potato puree.