Previously, presiding judges held significant power because they could choose which judges heard which cases, but the new law would assign cases using a lottery, government officials said, although exceptions would be made for cases deemed to be of special significance.
The two laws vetoed by the president — one that would have forced the resignation of all Supreme Court justices, with their replacements to be selected by the justice minister, and another that would have restructured the council that selects judicial candidates to give government-appointed members effective veto power — will be sent back to Parliament, which is expected to write new bills that would meet the president’s approval.
Parliament has the power to override the president’s veto, but doing so would require a supermajority of 60 percent — a threshold that the governing Law and Justice Party, which has only a thin majority, could not meet without the support of other parties.
What was unclear Monday was whether the Law and Justice Party would move the issue off the front burner, at least for the moment, or whether the veto exposed a rift between Mr. Duda and Jaroslaw Kaczynski, the leader of the governing party and the most powerful political figure in the country.
Mr. Duda, 45, a former backbencher in the ruling party, was handpicked by Mr. Kaczynski, 68, as the party’s presidential candidate, though he left the party to serve as an independent when he assumed office in August 2015.
Top ruling party officials began gathering late morning in Mr. Kaczynski’s spare office in the party headquarters. “We’ll be thinking on what stand to take on this,” said Ryszard Terlecki, the speaker of the Sejm, the lower house of parliament.
Pawel Kukiz, a Polish pop star who formed his own political party that was seen as the likeliest faction to side with Law and Justice on the issue, indicated on Monday that he agreed with Mr. Duda’s decision. “Thank you, Mr. President,” he posted on his Facebook page.
A member of Mr. Kukiz’s party, Stanislaw Tyszka, said the vetoes should spur “quick reform of the justice system.”
Opposition leaders welcomed the news of the vetoes, but warily, and said continued pressure on the government was needed.
“The situation is fresh,” said Andrzej Halicki, a member of parliament for Civic Platform, the leading opposition party. “Let’s not get ahead of ourselves.”
Lech Walesa, the Nobel Peace Prize laureate who led the Solidarity movement that toppled communism a quarter century ago, and who served as the first president after communism, said he had been “positively surprised” by Mr. Duda’s decision. Mr. Walesa has feuded with Mr. Kaczynski since the 1990s and has been frequently attacked by the current government.
Newsletter Sign Up
Thank you for subscribing.
An error has occurred. Please try again later.
You are already subscribed to this email.
“It was a hard and difficult decision, and a decision showing that Duda is beginning to feel like a president,” Mr. Walesa said.
But he called on protesters not to slacken their efforts.
“What’s comforting is that the nation is waking up, that the youth are waking up,” Mr. Walesa said. “Don’t stop protesting!”
President Trump visited Poland earlier this month and lavished praise on its government, without addressing the concerns of democracy advocates.
However, the State Department warned on Friday that “the Polish government has continued to pursue legislation that appears to undermine judicial independence and weaken the rule of law in Poland.” It added: “We urge all sides to ensure that any judicial reform does not violate Poland’s constitution or international legal obligations and respects the principles of judicial independence and separation of powers.”
Only about 200 people were gathered outside the presidential palace Monday morning, and they reacted jubilantly to the news of the vetoes. Tens of thousands have taken to the streets in Warsaw and across Poland over the last week, as the bills were debated and passed in Parliament, though mostly gathering after dark for candle and flashlight rallies.
Katarzyna Lubnauer, a member of Parliament for the opposition Modern Party, said critics of the proposed bills were willing to work with the ruling party to craft legislation to reform the courts, in which cases often languish for months and years. But she cautioned against moving too quickly.
“Wide-ranging talks are needed, wide-ranging consultations and not a fast legislative process,” she said.
Mr. Duda said there were several parts of the proposed legislation that troubled him, especially provisions that gave the country’s chief prosecutor and justice minister power over choosing high court justices. He was also upset that the bill was pressed through Parliament without being presented to his office for consultations.
“Poland needs reform of the judiciary,” Mr. Duda said, “But I am a supporter of a wise reform.”
He called on Parliament to write fresh legislation and said he hoped they could do so within two months.
Mr. Duda said he spent the weekend consulting with analysts, historians, philosophers, legal scholars and others but was most struck by a discussion he had with Zofia Romaszewska, a veteran anti-communist activist and government supporter.
She “told me something which struck me most during the weekend,” Mr. Duda said. “She said, ‘Mr. President, I lived in a state where the general prosecutor could do virtually anything and I wouldn’t like to come back to this state.’ ”
An earlier version of this article misstated the given name of a lawmaker who said the vetoes should spur “quick reform of the justice system.” He is Stanislaw Tyszka, not Pawel.