WARSAW — Andrzej Duda was a relatively obscure member of the right-wing Law and Justice party when the leader of the party and the most powerful man in the country plucked him from the chorus line to become its candidate for president in 2015. For most of the party’s first 20 months in power, he was a reliable proponent of the governing party’s nationalist initiatives.

On Monday, President Duda defied his patron, Jaroslaw Kaczynski, and vetoed two bills aimed at placing Polish courts firmly under political control.

“It seems that the reality inside the ruling camp is more complex than we might think,” said Rafal Chwedoruk, a political scientist at the University of Warsaw, in an interview with the Polish Press Agency.

There were already whispers of growing friction between the two leaders, an apparent schism that reflects a broader divide that has split Poland. The country was once in the vanguard of the democratic change that swept the region after the collapse of Communism. But it has steadily moved toward light authoritarianism and strident nationalism under Law and Justice, which has systematically dismantled much of that progress.

Law and Justice officials, seemingly blindsided by the vetoes, retreated to Mr. Kaczynski’s office in the party headquarters to discuss ways forward. In a speech to the nation, Beata Szydlo, the prime minister, defended the legislation and insisted the party would not give up.

“The president’s veto has slowed down the proceedings on reform,” Ms. Szydlo said. “But we will not back down from the path of repairing the state. We will not give in to pressures.”

Exactly how the party will proceed — whether it will seek to overturn the president’s veto, or come up with fresh legislation — she did not say.

Since assuming power, Law and Justice has drawn criticism from European Union officials and political opponents for a series of initiatives that, step by step, have placed formerly independent institutions more firmly under political control. Warnings from Brussels were met with defiance and counterwarnings to stay out of Poland’s domestic politics.

Mr. Duda’s move came after several days of dire warnings from the union that passing the laws could result in legal action, even sanctions — as well as after growing street protests.

One of the laws he vetoed would have forced the resignation of all Supreme Court justices, with their replacements to be selected by the justice minister. The other would have given government-appointed members effective veto power in the National Council of the Judiciary, which selects judicial candidates. Both will be sent back to Parliament.

Parliament has the power to override the vetoes, but doing so would require the agreement of 60 percent of lawmakers — a threshold that the Law and Justice Party, which has only a thin majority, could not meet without support from other parties.

No such partners stepped forward Monday. Pawel Kukiz, a pop star who formed his own political party and was considered the likeliest to side with Law and Justice, posted praise for President Duda on his Facebook page.

In a televised address Monday evening, President Duda said he intended to produce his own version of the bills because he agreed with the government that changes to the courts were needed.

“Without the reform of the justice system, there is no possibility of building a just state,” he said. “The bills prepared by the Parliament largely met these goals. However, I couldn’t sign them.”

Mr. Duda said he was troubled by the provisions that gave the country’s chief prosecutor and justice minister power over the choice of 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.”

A practicing Catholic and former Boy Scout with a cherubic smile and an upbeat demeanor, President Duda, 45, went along with the government’s earlier initiatives, like the one asserting control over the Constitutional Tribunal, which rules on the constitutionality of new legislation and is now dominated by government supporters. Another placed supporters in control of government-owned media.

The president came under heavy fire for pardoning a party official whose appeal on abuse of power charges was still working its way through the courts. The official, Mariusz Kaminski, was then put in charge of the country’s secret services.

But the latest moves against the courts were apparently a step too far for the president.

“I feel that the reform in this shape will not increase the sense of security and justice,” Mr. Duda said at the news conference.

Mr. Duda said he would sign a third bill, which reorganizes Poland’s local judiciary. It would give the justice minister the power to select the heads of the local courts and — in certain cases — even to direct judges to particular cases. Although protesters and political opponents praised the president’s vetoes, they said they would continue their campaign until the third bill is vetoed as well.

The president is a fresher and more telegenic personality than Mr. Kaczynski, now 68, a dour figure who lives alone in north Warsaw and prefers to govern from behind the scenes.

Mr. Duda, the son of teachers, was a studious young man in his native Krakow. He earned a law degree at Jagiellonian University in Krakow and joined its faculty, becoming chairman of its administrative law division.

Image

Demonstrators in Lublin, Poland, protesting on Sunday against the proposals.CreditAgencja Gazeta/Reuters

In the early 2000s, he was a member of the centrist Freedom Union Party, which supported liberal democratic policies and Western-style free market reforms. But by 2005, when he started his own law firm, his conservatism and Catholicism drew him to Law and Justice, which that year won power in parliamentary elections.

He was never a major figure in the party, first acting as a legal adviser, then as a deputy minister in the Justice Ministry and as a legal aide to Mr. Kaczynski’s twin brother, former President Lech Kaczynski, who died in a 2010 plane crash. For a few months, he was the party’s press spokesman. He lost a race for Parliament in 2007, though he got in a few years later, and finished third for mayor of Krakow in 2010.

By late 2014, when Mr. Kaczynski chose him as president, Mr. Duda was representing the party in the European Parliament in Strasbourg, France.

As the day dragged on, it became clearer that Mr. Kaczynski and the party’s leaders were genuinely surprised and upset by the president’s move.

Mr. Kaczynski will “never forgive” the president, said Mariusz Witczak, a lawmaker from Civic Platform, the leading opposition party.

“I believe this is the beginning of a conflict within the ruling camp,” said Krzysztof Gawkowski, secretary general of the Democratic Left Alliance, a small opposition party. “For now, it’s hard to say how far Andrzej Duda’s independence will go.”

Lech Walesa, the Nobel Peace Prize laureate who led the Solidarity movement that toppled Communism a quarter-century ago, called the decision “difficult and courageous.”

Mr. Walesa, who was the first president after Communism, and who has feuded with Mr. Kaczynski since the 1990s, said he was “positively surprised,” adding that he believed Mr. Duda was “beginning to feel like a president.”

But Mr. Walesa called on protesters not to slacken their efforts. “What’s comforting is that the nation is waking up, that the youth are waking up,” he said. “Don’t stop protesting!”

On Monday, the Nationwide Women’s Strike — a group that brought tens of thousands into the streets late last year in a successful effort to get the government to rescind a bill outlawing all abortions — gave Mr. Duda 48 hours to veto the third bill on local courts, warning of “civil disobedience on an unprecedented scale” if he failed to do so.

At Monday’s news conference, Mr. Duda said he had 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 who is a supporter of the government.

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.’”

Correction:July 24, 2017

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.

Correction:July 26, 2017

An article on Tuesday about a decision by President Andrzej Duda of Poland to veto two bills that would have placed his country’s courts under political control translated imprecisely part of the name of the country’s leading opposition party. It is usually rendered in English as Civic Platform, not Civil Platform.