Ukraine saw its largest popular protests since the 2004 Orange Revolution on Sunday when at least 300,000 people took to the streets calling for the resignation of the president, Viktor Yanukovych.

Furious at Ukraine's 11th-hour decision to back away from an EU integration pact in favour of closer relations with Russia, Ukrainians defied a court ban on protests. On the fringes, the mood turned violent as small groups of protesters stormed government buildings and clashed with riot police outside the presidential offices. About 200 masked protesters commandeered a mechanical digger and attempted to break through lines of armour-clad riot police.

The anger was galvanised by the violent break-up of a sit-in protest in Independence Square early on Saturday, when several hundred riot police dispersed the 1,000-strong crowd of mainly students, causing a number of casualties. City authorities claimed they needed to empty the square so a giant Christmas tree could be erected.

Early on Sunday, a Kiev court banned all rallies at Independence Square, but people flocked there in their thousands nonetheless. The Christmas tree was hung with Ukrainian flags and protesters waved yellow and blue Ukrainian and EU flags, with which many adorned their cars, honking horns in support of the protest rally. Chants went up of "Glory to the nation, death to its enemies" and "Out with the criminal", referring to Yanukovych's Soviet past as a petty criminal, as well as allegations of corruption in his inner circle.

Protesters try to drive through police cordons in a digger. Photograph: Alexey Furman/EPA

Pavlo Tumanov, 38, a doctor from Kiev, had stripes in the colours of the Ukrainian and EU flags tied to his hands. "I came to support the students who were brutally beaten yesterday. I'm sure Yanukovych ordered that, and was advised by Putin," he said, adding that it would be hard to oust the regime peacefully.

Opposition leaders spoke to the crowd from a small, hastily constructed stage, on which was written "Ukraine is Europe".

"This is not a meeting. This is not a rally. This is revolution," Yury Lutsenko, the opposition leader and former interior minister, told the crowd. People shouted back: "Revolution!"

The Polish politician Jacek Protasiewicz, vice-president of the European parliament, told the crowd: "You are part of Europe." The crowd roared back approvingly.

"Yanukovych is a political corpse," said Oleg Stavytsky, a 49-year-old engineer from Kiev, brandishing the EU flag. "After he spat in the face of Ukraine and Europe, he should realise that the only solution for him is to resign." Tatiana Troshkova, a 55-year-old economist from a town on the outskirts of Kiev, held a placard that read "Ukraine, rise!" "The west of Ukraine is already at this square. We want people from the Donbas [Yanukovych's stronghold in the east] to join us," she said, adding that she would be coming back to the streets every day for as long as she had the strength.

The protests demonstrated once again how divided Ukraine is, with the southern and eastern regions largely supporting closer relations with Russia, while the west and most of the centre focus on European integration.

Protesters wave international flags in Kiev. Photograph: Kommersant Photo/Kommersant via Getty Images

The EU pact, which was to have been signed at a summit in Vilnius last Friday, would have given Ukraine freer trade with Europe, but Yanukovych said it took no account of the ailing state of the country's economy, and that Europe did not offer the financial help required for modernisation. Russia had been staunchly against the deal, and it is believed Moscow offered financial incentives for Ukraine not to sign, with threats of punitive measures if it did.

Yanukovych's imprisoned rival Yulia Tymoshenko released a statement from hospital railing against the president until his regime was toppled. "I appeal to all Ukrainian people to resist and rise up against Yanukovych and his dictatorship," she wrote.

Tymoshenko led the Orange Revolution which stopped Yanukovych coming to power, but after years of disappointment and infighting, he won presidential elections in 2010. Shortly afterwards, Tymoshenko was jailed on charges widely believed to be politically motivated, and she is in a prison hospital in the eastern city of Kharkiv. She announced a hunger strike after Yanukovych said he would not sign the EU deal.

Other opposition leaders declared a national strike and called on people to block government buildings, demanding the resignation of the government and president.

However, the protest turned violent. Some protesters used gas, knives and smoke bombs against police lines. About 100 police had been injured in the clashes near the building by Sunday afternoon, according to the interior ministry, and 12 soldiers were also injured.

Riot police in Kiev. Photograph: Vasily Maximov/AFP/Getty Images

With Tymoshenko marginalised, Vitaly Klitschko, the heavyweight boxing champion who is one of Ukraine's main opposition leaders, is seen as the main threat to Yanukovych at the next presidential elections in 2015. On Sunday evening, he called on his supporters to remain calm and denounced the attempts to seize buildings by force.

"They stole the dream," he told the crowds on Independence Square. "If this government does not want to fulfil the will of the people, then there will be no such government, there will be no such president. There will be a new government and a new president."

Far-right nationalist leader Oleh Tyahnybok, meanwhile, called for workers' support. "From this day, we are starting a strike," he declared. If the idea of a national strike gains support, it will be a sure sign that the protests are more than just a flash in the pan.

All the opposition leaders denied any involvement with the violence, and accused the authorities of using hired thugs to create provocations. Order appeared to have been restored by Sunday night, with rows of riot police standing guard behind metal fences.

Arseniy Yatseniuk, leader of the Baktyvshchina party, told journalists he believed the clashes had been provoked as an excuse for Yanukovych to declare a state of emergency on Monday.

Inna Bohoslovska, a former ally of Yanukovych who left the president's party in protest against the bloody crackdown on protests in recent days, accused the Russian president, Vladimir Putin, and his Ukrainian ally Viktor Medvedchuk, leader of the Ukrainsky Vybor group, of masterminding provocations in Kiev.

Protesters cling to a gate near the presidential administration building. Photograph: Gleb Garanich/Reuters

Yanukovych's next move will be crucial. Over the weekend he criticised the violence, and insisted the country was still on the path to European integration. He was believed to be meeting his advisers at his country residence outside Kiev. Aides to Yanukovych said he still planned to travel to China on a long-planned trip on Wednesday, after which he is due in Moscow.