ROME — After almost a week of political gridlock, Italian President Sergio Mattarella has been reelected for a second term.

Mattarella conceded to pressure to stay on, in the interests of stability, following appeals from Prime Minister Mario Draghi, the governing political parties and the general public. In the end, Mattarella garnered 759 of the 1,009 possible votes.

Parliamentarians and regional delegates had been voting since Monday to find a successor for Mattarella whose seven-year term expires on February 3. Mattarella had repeatedly indicated that he didn’t want to serve a second term.

But as no political bloc had a majority, lawmakers seemed unable to reach an agreement on another candidate, threatening the stability of the government.

With party leaders apparently unable to break the stalemate, rebel lawmakers took charge of the situation, increasingly backing Mattarella in the daily ballots, with his tally rising from 125 on Wednesday, to 387 on Saturday, which was about two-thirds of votes cast; and then 759.

On Saturday morning, Draghi called Mattarella to ask him to stay on in the interest of stability, according to a person familiar with the situation. Draghi then lobbied party leaders to converge on the plan.

Draghi himself had been considered a candidate but failed to get wide backing from the parties, because of the difficulty of finding a replacement as prime minister who could command the same governing majority. Draghi will continue as prime minister.

Party whips met with Mattarella on Saturday to ask him to remain in the post. Senator Julia Unterberger said: “Given the situation, we begged him to stay for another term.” Mattarella said he “had other plans for his future,” but given the situation would make himself available, Unterberger said.

In a press conference, Enrico Letta, leader of the leftist Democrats, called Mattarella’s choice “a decision of generosity to the country, which today was fundamental, important and necessary.”

Only the opposition Brothers of Italy voted against Mattarella. Ignazio La Russa, Brothers of Italy senator, said choosing Mattarella was “demeaning and offensive.”