The Justice Ministry had condemned protests outside courthouses and warned against dragging the judiciary into the political fray. It also said that any laws affecting the judiciary must be made in coordination with judges.
Mekki said in his letter that his resignation came as a response to pressure from the president's opponents and supporters, both of whom called for it. He also mentioned as reason Friday's protests by Islamists urging a "cleansing" of the judiciary, as well as calls for a new judicial reform law.
"Therefore, a consensus has been reached. Please realize my wish to remove the burden from my shoulders," he wrote.
Although Cabinet spokesman Alaa el-Hadidy announced on Sunday that Mekki had submitted his resignation, the presidency did not immediately say it had been accepted.
Legal expert Nasser Amin, the head of the Arab Center for the Independence of the Judiciary, says he considers the resignation to have come too late.
"He should have resigned earlier when it first appeared that Morsi was trying to control the judiciary," Amin said.
"His resignation shows that he has discovered the government does not want to reform the judiciary but wants to control the judiciary," he added.
Despite his history as a judge who pushed for independence under Mubarak, Mekki outraged activists when he backed a disputed forensic report that said 28-year-old Mohammed al-Gindy had died in a car accident in February. Mekki oversees the state forensic authority.
Family and friends of al-Gindy said he died after he was given electric shocks and repeatedly beaten on his head in detention. Security officials deny he was held in detention.
Mekki also infuriated many in the judiciary when he tried to mediate on behalf of Morsi last November after the president issued decrees that made his decisions immune from judicial challenge for a time. The decrees protected an assembly drafting a new constitution from being dissolved by the courts and allowed him to unilaterally install a new prosecutor. The prosecutor remains in place despite a court order last month annulling his appointment.
The latest blow to Morsi's backers came Sunday when a government legal agency representing the president lost an appeal to reverse the suspension of parliamentary elections that were slated to start this month.
The ruling by the Supreme Administrative Court, which is final, upholds a lower court ruling to suspend the elections because the law governing the vote was illegal and its passage by the Islamist-dominated temporary parliament was procedurally improper.
The president's Brotherhood party had been pushing to hold elections for the law-making body now, saying it is essential for stability and a transition to democracy.
The opposition had expressed concerns, however, that the election law allowed for gerrymandering by the Brotherhood-dominated temporary parliament.