Ukrainian President Petro Poroshenko shows the Ukraine-E.U. association agreement to lawmakers after its signing in Kiev on Tuesday. (Mykola Lazarenko/AP)

Ukraine on Tuesday ratified a landmark deal to move closer to the European Union, while also making painful concessions to Russia in a sign that the nation is far from escaping its neighbor’s powerful orbit.

In a ceremony filled with pomp and patriotism, Ukraine’s parliament ratified the E.U. deal, which had been rejected in November by the country’s former president, Viktor Yanukovych, setting off months of pro-European street protests that deposed him and unleashed a grinding conflict in Ukraine’s east that has claimed more than 3,000 lives.

But the ratification took place after an unusual closed-door session in which the parliament granted sweeping amnesty to the pro-Russian rebels who have seized portions of eastern Ukraine. Those territories were also given significant new powers to rule themselves. Both measures were attempts to sustain a tenuous Sept. 5 cease-fire whose terms were largely dictated by Russian President Vladimir Putin.

The dueling decisions were a testament to how much Ukraine remains trapped in the orbit of Russia, which shares centuries of cultural, political and linguistic history with its smaller neighbor. Many Ukrainians want to join the European Union, but Russia has shown that it is willing to sustain steep costs to retain influence over a country that until 23 years ago was part of the Soviet Union.

E.U. nations, by contrast, are far from united about whether they want to accept Ukraine as a full member.

The ratification of the E.U. deal was coordinated with E.U. lawmakers in Strasbourg, France, and staged amid great fanfare in Kiev. It prompted a standing ovation from legislators, who leapt to their feet to sing the Ukrainian national anthem. President Petro Poroshenko told lawmakers that the vote was a “first but very decisive step” toward integrating Ukraine with the European Union.

“Since World War II, not a single nation has paid such a high price for their right to be European,” Poroshenko said.

But the E.U. agreement was throttled back by a significant olive branch to Russia, after Poroshenko last week delayed key economic provisions of the pact until the end of 2015, temporarily soothing the Kremlin’s concerns that low-tariff European products could flood the Russian market via Ukraine.

Many Ukrainians have pinned their hopes for the future of their country on the measures enshrined in the E.U. deal, which commits Ukraine to taking steps to combat corruption, open its economy and strengthen the rule of law. But the delay in implementing the full deal has disappointed some of Poroshenko’s supporters, and a deputy foreign minister, Danilo Lubkivsky, resigned last week in protest.

The decision Tuesday to enshrine in law an amnesty and a framework for self-rule in the east was a major concession to Russia that in many ways gave the Kremlin and pro-Russian rebels what they have been seeking since early in the conflict, long before the violence broadened and thousands died.

Early local elections will be held in December, and local governments will have broad oversight powers over judicial and prosecutorial appointments and will create local control over police forces. The use of the Russian language will be guaranteed. Most of the measures will be in force for three years, after which the constitution will have been modified to permanently devolve power to the regions.

But after five months of violence, it is unclear whether the measures will be enough to assuage Russia or the rebels, nor whether the law can hold off an end to the increasingly tenuous cease-fire. Donetsk’s city administration said Tuesday that three people died and five were wounded in shelling, while Ukrainian military spokesman Col. Andriy Lysenko said three Ukrainian soldiers had been killed in the previous 24 hours.

Rebels have said they want full independence from Ukraine. Still, some of their leaders sounded more conciliatory Tuesday than they had in the past, stopping short of full rejection of the measures.

“We cannot accept any political union with present-day Ukraine,” said a top rebel leader in Donetsk, Andrei Purgin, in an appearance on state-run Russia 24 television. But he said the rebels planned to study the legislation.

“We must be realists. We must understand that politics is the art of the possible,” he said.

Any loss of sovereignty in the east hurts Ukraine’s chances to join NATO — a complication that Russia would welcome.

The measures were met with mixed reactions Tuesday from the pro-European activists who were the driving force behind the winter protests in Kiev and who form an influential part of Poroshenko’s base.

“At the initiative of the president and the hands of the parliament, Donbas has been surrendered,” legislator Andriy Shevchenko wrote on Twitter, referring to the region that is at the heart of the rebellion.

Others were more cautious.

“It is a real step toward implementing peace and stopping bloodshed,” said Marianna Shimanovich, a volunteer with an organization that provides aid to Ukrainian soldiers. “But there is a recognition of losing sovereignty in these territories.”

William Branigin in Washington and Natalie Gryvnyak in Kiev contributed to this report.