why does my car jerk on idle and my lights turn dim when jerking on 1999 Mazda Millenia

When I come to a complete stop my car shakes and when it shakes the lights go a little dim?

Asked by for the 1999 Mazda Millenia
i agree with #1
1 more answer , 1 more comment
there are a few possibilities like low/erratic idle due to a vacuum leak will also cause lights to dim due to low charging system voltage,loose battery connections,and pretty much anything that will make the car idle low can also affect the charging system output.I would not only test the charging system,but scan for engine codes as well.
thank you!