In a small saucepan over medium-high heat, toast black peppercorns, coriander and star anise until fragrant. Set aside to cool.
In a large non-reactive bowl, combine toasted spices, sea salt, sugar, herbs, shallots and garlic. Press duck legs into mixture to coat each leg evenly. Tightly cover bowl and marinate in the refrigerator for 24 to 48 hours.
Preheat oven to 200°. In a small saucepan, melt the duck fat. Remove duck legs from the refrigerator and carefully brush marinade from the legs. Arrange the legs in a single, tight layer in an earthenware casserole or heavy lidded 6-quart stock pot. Pour the melted duck fat over the duck legs to cover and place in the oven.
Allow to cook gently until meat is easily pierced and nearly falls away from the bone, approximately 4 to 5 hours. Remove duck from oven, cool and store in the existing fat. The confit can be stored for up to two weeks in a covered container, but should be salted a day before you plan to cook it.
This flavorful meat can be used in a variety of simple preparations, including our recipe for duck rillettes with cannellini beans and edamame.