CAIRO — Tens of thousands of anti-government protesters inspired by Tunisia’s uprising staged the biggest demonstrations in Egypt in years, facing down riot police who beat them with batons and fired water cannons in clashes that left at least three dead.

The protests to demand an end to President Hosni Mubarak’s 30-year authoritarian rule and a solution to Egypt’s grinding poverty could embolden the opposition and fuel growing dissent in a presidential election year.

Mobilized largely on the Internet, the waves of protesters filled Cairo’s central Tahrir Square, some hurling rocks and climbing atop armored police trucks.

“Down with Hosni Mubarak, down with the tyrant,” chanted the crowds. “We don’t want you!” they screamed as thousands of riot police deployed in a massive security operation that failed to quell the protests.

As night fell, thousands of demonstrators stood their ground and settled in for an all-night sit-in in Tahrir Square, just steps away from parliament and other government buildings, blocking the streets and setting the stage for more dramatic confrontations.

Discontent with life in Egypt’s authoritarian police state has simmered under the surface for years. However, it is Tunisia’s popular uprising, which forced that nation’s autocratic ruler from power, that appears to have pushed young Egyptians into the streets, many for the first time.

“This is the first time I am protesting, but we have been a cowardly nation. We have to finally say no,” said Ismail Syed, a hotel worker who struggles to live on a salary of $50 a month.

“We want to see change, just like in Tunisia,” said 24-year-old Lamia Rayan.

Dubbed a “day of revolution against torture, poverty, corruption and unemployment,” Tuesday’s protests in cities across Egypt began peacefully, with police at first showing unusual restraint in what appeared to be a calculated strategy to avoid further sullying the image of a security apparatus widely criticized as corrupt and violent.

With discontent growing over economic woes and the toppling of Tunisia’s president resonating in the region, it was an acknowledgment of the need to tread softly by an Egyptian government that normally responds with swift retribution to any dissent.

But as crowds filled Tahrir Square — waving Egyptian and Tunisian flags and adopting the same protest chants that rang out in the streets of Tunis — security personnel changed tactics and the protest turned violent.

At one point, demonstrators attacked a water cannon truck, opening the driver’s door and forcing the man out of the vehicle. As protesters hurled rocks and dragged metal barricades, officers beat them back with batons.

Protesters emerged stumbling amid clouds of acrid tear gas, coughing and covering their faces with scarves. Some had blood streaming down their faces. One man fainted. Police dragged some away and clubbed a journalist, smashing her glasses and seizing her camera.

The sight of officers beating demonstrators had particular resonance because Tuesday was a national holiday honoring the much-feared police.

Like the Tunisian protests, the calls to rally in Egypt went out on Facebook and Twitter, with 90,000 people voicing their support. Throughout the day organizers used Twitter to give minute-by-minute instructions about where to gather in an attempt to outmaneuver the police, until the government blocked it in the late afternoon.

After remaining silent throughout the day, Egypt’s government called Tuesday night for an end to the protests. The Interior Ministry, which controls the security forces, said authorities wanted to let the protesters express their opinions and accused the crowds of “insisting on provocation.”

“Some threw rocks at police … and others carried out acts of rioting and damage to state institutions,” it said. The ruling party said some 30,000 protesters had turned out across the country.

“Egyptians have the right to express themselves,” said Egypt’s Foreign Ministry spokesman, Hosam Zaki.

In Washington, Secretary of State Hillary Rodham Clinton said Egypt’s government, a key U.S. ally in the Middle East, was stable and Egyptians have the right to protest, though she urged all parties to avoid violence.

The dead in Tuesday’s violence included a policeman who was hit in the head with a rock in Cairo, and two protesters who died in the city of Suez east of Cairo, an Interior Ministry official said.

Nearly half of Egypt’s 80 million people live under or just above the poverty line, set by the U.N. at $2 a day. The widespread poverty, high unemployment and rising food prices pose a threat to Mubarak’s regime at a time when tensions between Muslims and Christians are adding to the nation’s woes.

“I support change,” said Sami Imam, a 53-year-old retired teacher who took part in Tuesday’s protests. “The police cannot kill us because we, to all practical purposes, are already dead,” said the father of four, clutching Egypt’s red, white and black flag.

“I have not visited the butcher in six months,” he said, in a reference to Egypt’s rising meat prices.

Adding to the uncertainty is that Mubarak, 82 and ailing, has yet to say whether he plans to run for another six-year term in office. Mubarak has not appointed a deputy since he became president in 1981 and is widely thought to be grooming his son Gamal to succeed him.

The protests also follow a parliamentary election marred by allegations of widespread fraud that saw Mubarak’s ruling National Democratic Party win all but a small number of the chamber’s 518 seats.

In recent weeks, Mubarak and his son have repeatedly vowed to ensure that ambitious economic reforms engineered by the younger Mubarak over the past decade filter down to the poor. But that has not happened and there has been a marked increase in the frequency of street protests over the economy.

In another parallel with Tunisia, the protests drew energy from the death of a single young man: a young Egyptian named Khaled Said whose family and witnesses say was beaten to death by two policemen in Alexandria last year. His slaying has become a rallying point for Egypt’s opposition.

Tunisia’s protests were also sparked by a single death, that of a poor Tunisian vegetable vendor who set himself on fire to protest corruption. That act has been copied by at least six people in Egypt.

On Tuesday, mothers carrying babies joined protesters who chanted, “Revolution until Victory!” and waved signs reading “OUT!” inspired by the Tunisian slogan “DEGAGE!” Men sprayed graffiti reading “Down with Hosni Mubarak.”

Some passers-by dismissed the protests, saying a few thousand of Cairo’s 18 million people coming out on the streets was not nearly enough to force change.

“This is all just a waste of time,” said Ali Mustafa Ibrahim, who works at a cigarette stand. “These are a bunch of kids playing cat and mouse. … It’s just going to create more problems and more traffic in the city.”

Among the protesters in Cairo was Alaa al-Aswany, author of the best-selling “Yacoubian Building,” which portrays corrupt politicians, police brutality and terrorism in Egypt.

A keen observer of Egyptian society, al-Aswany said the demonstrations were an important opening for the government’s opponents.

“They broke the barrier of fear,” he said. “The writers of the regime were saying Egypt is not Tunisia and Egyptians are less educated that Tunisians. But here is the thing: these young people proved they can take their rights forcefully.”

Associated Press writers Maggie Michael, Sarah El Deeb and Hadeel al-Shalchi contributed to this report.