Wash the lemons thoroughly and scrub the skins to remove any wax. Dry them, remove all seeds, and finely chop the lemons, including the peel.
Peel and finely grate the fresh ginger. Thinly slice the red chilies, removing the seeds if you prefer a milder jam.
Combine the chopped lemons, grated ginger, sliced chilies, and water in a large saucepan. Simmer over medium heat for 15–20 minutes, stirring occasionally until the lemon peel softens.
Gradually stir in the sugar until completely dissolved. If using powdered pectin, prepare it according to the package directions.
Bring the mixture to a full rolling boil. Continue boiling for 8–12 minutes, stirring frequently until the mixture thickens.
Place a teaspoon of jam onto a chilled plate. After 1 minute, push it with your finger. If it wrinkles and holds its shape, it's ready. If not, boil for another 2 minutes and test again.
Sterilize the jars and lids by boiling them for 10 minutes or using the dishwasher's sanitize cycle. Keep the jars warm.
Ladle the hot jam into the warm jars, leaving ¼ inch (6 mm) headspace. Remove air bubbles and wipe the rims clean.
Apply the lids and tighten them until fingertip tight.
Allow the jars to cool undisturbed for 12–24 hours. Check that each lid has sealed before storing.