Announcing the resignation on state-run television, Ansah said she was leaving office “full of confidence” despite the controversial circumstances that led to her departure.
“I have worked with clean hands and I have no skeletons in my cupboard. I have fought a good fight and I am happy that I have seen it to the end,” she said.
The outgoing MEC chief has been a controversial figure in Malawi following disputed elections held in May 2019.
She has been the target of nationwide protests over the commission’s handling of elections held in May 2019 that handed President Peter Mutharika a second term.
The outcome of the poll was however successfully challenged by the opposition, with the country’s Constitutional Court in February ordering a rerun of the presidential poll within 150 days.
Ansah’s resignation comes weeks after the Supreme Court threw out a challenge of the Constitutional Court ruling by Mutharika and MEC.
Legal experts say the resignation is not going to have an effect on the holding of elections set for June 23.
Mutharika is expected to appoint an interim head of MEC as the country prepares for elections.