Mr. Mattarella, a former member of Parliament, a defense and education minister and a judge on Italy’s constitutional court, became president in 2015 and since then has sought to stay above the political fray.

In keeping with his trademark aversion to drama, Mr. Mattarella sought to avoid a return to the polls in the summer or fall, which could produce the same impasse. He said he hoped the parties could reach an agreement by the end of December, when his caretaker government would expire. If not, he said, elections should be held in the new year.

Italy’s leading politicians did not want to wait that long.

The leaders of the Five Star Movement, Luigi Di Maio, and the League, Matteo Salvini, met on Monday for the first time since the elections to pick a date for new elections.

“July 8 is the first possible date to vote, and Di Maio also agrees,” Mr. Salvini told reporters.

On Monday morning, Mr. Salvini, whose party won the most votes in a center-right coalition with former Prime Minister Silvio Berlusconi, urged Mr. Mattarella to give his alliance a mandate to seek enough support in Parliament to form a government. But with the coalition about 50 seats short of a majority, Mr. Mattarella did not bother.

Mr. Salvini then rejected the president’s offer on Monday evening.

“Mattarella wants a ‘neutral government’? Please,” Mr. Salvini, a gifted campaigner, wrote on Twitter, adding that Italy needed a government “that defends in Europe the principle ITALIANS FIRST.”

Mr. Salvini seemed to anticipate the president’s decision, taking to Facebook earlier to prepare his base for coming elections. He told them that more migrants were already coming and that if the negotiations failed, “we will come to ask you for that 2, 3, 4 percent more votes which would give us the chance to govern alone for five years, without asking permission of anyone.”

Mr. Mattarella had given the Five Star Movement time and space to find support on the right, with the League, and with the center-left Democratic Party that it spent much of the last few years insulting. But after 65 days of negotiations, he apparently had had enough.