KIEV, Ukraine (AP) - In a fast-moving day that could significantly shift Ukraine's political destiny, opposition leaders signed a deal Friday with the country's beleaguered president that calls for an early election, a new constitution and a new unity government.

Ukraine's newly empowered parliament also fired the country's despised interior minister and voted to free Yulia Tymoshenko, the former prime minister who has spent more than two years in jail for what supporters say are politically tainted charges.

It was not clear, however, how well the deal would go down with all the sides involved in Ukraine's protracted political crisis. A senior Russian lawmaker immediately criticized it as being crafted for the West, and Ukrainian protesters angry over police violence showed no signs of abandoning their sprawling encampment in central Kiev.

Still, if it holds, the ambitious agreement could be a major breakthrough in a months-long crisis over Ukraine's future, a standoff that worsened sharply this week and left scores dead and hundreds wounded in the worst violence the country has seen since it became independent in 1991.

Within hours of the signing, Ukraine's parliament voted to restore the 2004 constitution that limits presidential authority, clawing back some of the powers that President Viktor Yanukovych had pushed through for himself after being elected in 2010.

Although Yanukovych retains an apparent majority in parliament, he loses the power to nominate the prime minister and to fire the Cabinet. Lawmakers also approved an amnesty for protesters involved in violence.

The Verhovna Rada parliament then voted to fire the interior minister, Vitali Zakharchenko, who is widely despised and blamed for ordering police violence, including the snipers who killed scores of protesters Thursday in central Kiev.

The next order of business was Tymoshenko. Legislators voted 310-54 to decriminalize the count under which she was imprisoned, meaning that she is no longer guilty of a criminal offense.

"Free Yulia! Free Yulia!" legislators chanted after the vote.

It's not immediately clear when she might be released from the jail in the eastern city of Kharkiv.

Three European foreign ministers spent two days and all night trying to negotiate an end to the standoff, which began when Yanukovych decided not to sign a pact with the European Union in November in favor of having closer ties with Russia.

The U.S., Russia and the 28-nation EU are deeply concerned about the future of Ukraine, a nation of 46 million that has divided loyalties between Russia and the West. The country's western regions want very much to be closer to the EU and have rejected Yanukovych's authority in many cities, while eastern Ukraine favors closer ties with Russia.

The agreement signed Friday says presidential elections will be held no later than December, instead of March 2015 as scheduled. Many protesters say December is too late - they want Yanukovych out immediately. It was not clear Friday how soon he will leave office.

Ukrainian authorities also will now name a new unity government that includes top opposition figures within 10 days.

But neither side won all the points it sought, and some vague conditions could ignite strong disputes down the road.

The deal says the government will not impose a state of emergency and both sides will refrain from violence. It says opposition protesters should hand over any weapons and withdraw from buildings they have occupied and protest camps around the country.

It is far from clear that the thousands of protesters camped out in Kiev on Friday will pack up and go home. One by one, protesters took to a stage on Independence Square, known as the Maidan, to say they're not happy.

"Resign! Resign! Resign!" they chanted.

"The Maidan will stand up until Yanukovych leaves," said protester Anataly Shevchuk, 29. "That's the main demand, both for those who were killed, and for those who are still standing on the Maidan."

"I hope that the direction of the country changes, but so far the goals of the Maidan have not been achieved," said Kira Rushnitskaya, a 45-year-old protester. "Yanukovych agreed to give up powers to stay in power overall."

No deadline for leaving the camp in central Kiev has been set and many protesters are likely to move out slowly, both because of the emotional closeness the camp fostered and because of distrust that the deal will actually be implemented.

The capital remained tense Friday. Shots were heard in the morning, a day after the deadliest violence in Ukraine's post-Soviet history. It is unclear who was targeted and whether anyone was hurt or injured.

The leader of a radical group that has been a driver of violent clashes with police, Pravy Sektor, declared Friday "the national revolution will continue," according to the Interfax news agency.

The deal has other detractors too.

Leonid Slutsky, a Russian lawmaker who chairs the committee in charge of relations with other ex-Soviet nations, told reporters Friday that the agreement serves the interests of the West.

"We realize where and by whom this agreement has been written. It's entirely in the interests of the United States and other powers, who want to split Ukraine from Russia," he said.

At the same time, Slutsky shrugged off claims that Russia could send its troops to Ukraine, saying Moscow will communicate with any government Ukraine has.

"No matter how bad and hard to deal with the new government is for us, we will deal with it," he said. "We must learn from mistakes we have made."

Protesters across the country are upset over corruption in Ukraine, the lack of democratic rights and the country's ailing economy, which just barely avoided bankruptcy with the first disbursement of a $15 billion bailout promised by Russia.

Friday's agreement does not address the grievance that set off the protests in the first place - Yanukovych's shelving of an agreement to deepen ties with the European Union and his turn toward Russia for financial assistance.

The avid desire of many Ukrainians to step out of Russia's long shadow and become more integrated with the West remains a serious, unresolved issue for Ukraine.