KYIV, Ukraine — Russian tanks were rolling over the border and Kyiv, the Ukrainian capital, was in the grips of fear and panic. Street fighting broke out and a Russian armored column, barreling into the city, advanced to within two miles of the office of President Volodymyr Zelensky.
In those tense first days of the war, almost everyone — Russian President Vladimir V. Putin, military analysts and many Western officials — expected the Ukrainian leadership to fracture. Instead, Mr. Zelensky decided to personally remain in the capital, taking selfies as he traversed Kyiv to reassure his people. And he ordered his senior aides, many Cabinet members and much of his government to also stay put, despite the risks.
It was a crystallizing moment for Mr. Zelensky’s government, ensuring a wide array of agencies kept running efficiently and in sync. Leading politicians put aside the sharp-elbowed infighting that had defined Ukrainian politics for decades and instead created a largely united front that continues today.
No senior officials defected or fled, and the bureaucracy quickly went onto a war footing.
“In the first days of the war, everybody was in shock, and everybody was thinking what to do — stay in Kyiv or evacuate,” said Serhiy Nikiforov, Mr. Zelensky’s spokesman. “The president’s decision was no one goes anywhere. We stay in Kyiv, and we fight. That cemented it.”
To much of the world, Mr. Zelensky is best known for appearing by video link with a daily message of courage and defiance, to rally his people and exhort allies to provide weapons, money and moral support. On Sunday he commanded global attention again in a meeting in Kyiv with two top American officials, Secretary of State Antony J. Blinken and Defense Secretary Lloyd J. Austin III, who pledged more military support and — in a move of symbolic importance — said the United States would seek to reopen its embassy in Kyiv.
But behind the scenes, Mr. Zelensky’s success so far is also rooted in the government’s ability to operate smoothly and take measures to help people cope, such as sweeping deregulation to keep the economy afloat, and to provide essential goods and services.
By loosening rules around transporting cargo, for instance, the government was able to address a dire risk of food shortages in Kyiv, the capital, in the early days of the war. And in March he dropped business taxes to 2 percent — and then only if the owner wanted to pay.
“Pay if you can but if you cannot there are no questions asked,” Mr. Zelensky said at the time.
More contentiously, he combined six television stations that previously competed against one another into one outlet for news. The merger, he said, was necessary for national security, but it frustrated political opponents and free speech advocates.
He has also forged a truce with his primary domestic political opponent, former President Petro O. Poroshenko, with whom he had been feuding right up until the start of the war.
A tremendous wartime effect of rallying around the flag undoubtedly eased Mr. Zelensky’s job, said Volodymyr Yermolenko, editor in chief of Ukraine World, a magazine covering politics. “The peculiar thing about Ukrainian politics is the agency comes from society, not the political leaders,’’ he said. “Zelensky is who he is due to the Ukrainian people, who are behind him, showing courage.”
He added that, “this is not to undermine his efforts” and credited Mr. Zelensky for adapting his populist, prewar politics into an effective leadership style in the crucible of conflict.
These days Mr. Zelensky’s workplace on Bankova Street is a hushed, darkened space crowded with soldiers; there are firing positions protected by sandbags in the corridors and on stairway landings. “We were prepared to fight exactly in this building,” said Mr. Nikiforov.
A former comedic actor, the Ukrainian leader has surrounded himself with a group of loyalists from his days in television, relationships that prompted accusations of cronyism in the past but that have served him well during the conflict by keeping his leadership team on the same page. And Mr. Zelensky has structured his days in a way that works for him.
Mr. Zelensky receives one-on-one phone briefings from Gen. Valeriy Zaluzhnyi, the commander of the armed forces, multiple times a day and often first thing in the morning, aides and advisers said.
This is followed by a morning video conference with the prime minister, sometimes other members of the Cabinet, and military and intelligence agency leaders in a format that combines military and civilian decision making, according to Mr. Nikiforov, his spokesman.
To be sure, Mr. Zelensky’s video addresses — to the U.S. Congress, to the British Parliament, to the Israeli Knesset and other governments — remain the defining and most effective element of his wartime role. The Ukrainian and Russian armies are still in pitched battles in the eastern plains, but in the information war Kyiv has clearly won.
Delivered with passion by a former actor with a keen sense of narrative and drama, Mr. Zelensky’s speeches have rallied his countrymen and galvanized international support.
Some are ad-libbed and others more scripted. A 38-year-old former journalist and political analyst, Dmytro Lytvyn, has reportedly served as Mr. Zelensky’s speechwriter. Mr. Nikiforov, the spokesman, confirmed the president is collaborating with a writer but declined to say with whom.
Politically, Mr. Zelensky made some early moves that allowed him to reduce any internal strife that might detract from the war effort.
Among them was the uneasy rapprochement with Mr. Poroshenko, who had sharply criticized Mr. Zelensky since losing to him in the 2019 election. Their squabbling continued even as Russia massed troops on the border, with Mr. Zelensky’s prosecutor putting Mr. Poroshenko under house arrest for various politically tinged cases.
But the day that Russia invaded, the two leaders reached an understanding. “I met with Mr. Zelensky, we shook hands,” Mr. Poroshenko said in March. “We said that we are starting from scratch, he can firmly count on my support, because now we have one enemy. And the name of this enemy is Putin.”
Mr. Zelensky outlawed another main opposition faction, a Russian-leaning political party.
It has helped that Mr. Zelensky’s political party, Servant of the People, won a majority of seats in Parliament in 2019, allowing him before the war to appoint a cabinet of loyalists. Past Ukrainian governments were divided between feuding presidents and opposition-controlled cabinets.
“Not on paper, but in reality, it’s all one big team,” said Igor Novikov, a former foreign policy adviser. “It’s very close knit.”
Tymofiy Mylovanov, a former minister of economy and now an economic adviser to the president’s office, likened Ukrainian politics to “loved ones fighting.”
“It’s a family fight,” he said. “But family comes first.”
The inner circle is made up largely of media, movie and comedy industry veterans with backgrounds similar to Mr. Zelensky’s.
Andriy Yermak, the chief of staff and a former movie producer, is widely viewed as the second most-powerful politician in Ukraine, though the constitutional successor is the Speaker of Parliament, Ruslan Stefanchuk, who early in the war was evacuated to western Ukraine. Mr. Yermak oversees foreign and economic policy.
Other key advisers are Mykhailo Podolyak, a former journalist and editor who is a negotiator with the Russians; Serhiy Shefir, a former screenwriter, now a domestic political adviser; and Kirill Tymoshenko, a former videographer now overseeing humanitarian aid.
The top military command is made up of officers, including General Zaluzhnyi, experienced in fighting Russia through the eight years of conflict in eastern Ukraine.
In the first days of the war Mr. Zelensky set three priorities for his government’s ministries, according to Mr. Mylovanov: weapons procurement, shipments of food and other goods, and maintaining supplies of gasoline and diesel. The ministries were told to rewrite regulations to ensure swift delivery on all three tracks.
That was perhaps most helpful in the frantic rush early on to get food to Kyiv, which was at risk of being besieged and starved.
With the supply chain disrupted, the presidential office brokered an arrangement among grocery chains, trucking companies and volunteer drivers to establish a single trucking service supplying all food stores. Stores would post a request on a website, and whichever driver was available would fill the order either for free or for the cost of gasoline.
Perhaps the most controversial move Mr. Zelensky made was to combine the six television newsrooms into one channel with a single report. Omitted from the group was the main opposition television station, Channel 5, affiliated with Mr. Poroshenko.
Mr. Zelensky positioned the move as necessary for national security. Opponents viewed it as a troubling instance of the government suppressing dissent.
“I do hope that wisdom will prevail, and the intention is not to use this to keep political competitors down,” said Volodymyr Ariev, a member in Mr. Poroshenko’s Solidarity political party.
Transparency in the Ukrainian Parliament has also been a casualty of war.
The Parliament sits at irregular, unannounced intervals lasting an hour or so, for security reasons, lest a quickly targeted Russian cruise missile strike.
To hasten sessions, members do not debate bills publicly in the chamber but in private while drafting them, according to Mr. Ariev. Then parliamentarians gather in the stately, neo-Classical chamber, quickly vote, then scatter.
Mr. Mylovanov, the economic adviser to the president, said Ukraine’s pluralistic political culture would bounce back. Unity now is necessary, he said.
“Don’t worry,” he said. “We will be back to fighting over a liberal versus protectionist economic policy, price controls, how to attract investments, and all the rest of it.”
Maria Varenikova contributed reporting from Kyiv.