CAIRO — Thousands of anti-government protesters, some hurling rocks and climbing atop an armored police truck, clashed with riot police Tuesday in the center of Cairo in a Tunisia-inspired demonstration to demand the end of Hosni Mubarak’s nearly 30 years in power.
Police responded with blasts from water cannons and set upon crowds with batons and acrid clouds of tear gas to clear demonstrators crying out ‘‘Down with Mubarak’’ and demanding an end to Egypt’s grinding poverty, corruption, unemployment and police abuses.
Tuesday’s demonstration, the largest Egypt has seen for years, began peacefully, with police showingunusual restraint in what appeared to be a calculated strategy by the government 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 still resonating in the region, Egypt’s government — which normally responds with swift retribution to any dissent — needed to tread carefully.
But as crowds filled downtown Cairo’s 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. Around 10,000 protesters packed the vast square, the Interior Ministry said.
The sight of officers beating demonstrators had particular resonance because Tuesday was also a national holiday honoring the much-feared police.
In Egypt, discontent with life in the autocratic, police state has simmered under the surface for years. It is the example of Tunisia, though, that appeared to be enough to push many young Egyptians into the streets 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 24-year-old Ismail Syed, a hotel worker who struggles to live on a salary of $50 a month.
Demonstrators attacked a water cannon truck, opening the driver’s door and ordering the man out of the vehicle. Some hurled rocks and dragged metal barricades. Officers beat back protesters with batons as they tried to break cordons to join the main group of demonstrators downtown.
Protesters emerged stumbling from white clouds of tear gas, coughing and covering their faces with scarves.
Some had blood streaming down their faces. One man fainted. Police dragged some away and beat a journalist, smashing her glasses and seizing her camera.
Crowds also marched to the headquarters of Mubarak’s National Democratic Party, shouting, ‘‘Here are the thieves.’’
After remaining silent throughout the day, Egypt’s government on Tuesday night called for an end to the protests. The Interior Ministry, which controls the security forces, said authorities wanted to allow the protesters the chance to 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.
In Washington, Secretary of State Hillary Rodham Clinton said Egypt’s government, a key U.S. ally in the Middle East, is stable despite the outpouring. Clinton said Egyptians have the right to protest, but urged all parties to avoid violence.
At one point Tuesday, the protesters seemed to gain the upper hand, forcing a line of riot police to flee under a barrage of rocks. One demonstrator climbed into a fire engine and drove it away.
‘‘I want my 3-year-old child to grow up with dignity and to find a job just like the president,’’ said 50-year-old Eid Attallah, who works as a driver.
He said he had heard about the planned protests from friends but didn’t expect them to be so big.
Many expressed similar surprise.
‘‘We are fed up; this is just enough,’’ said Sayid Abdelfatah, a 38-year-old civil servant who marched with an Egyptian flag. ‘‘Tunisia’s revolution inspired me but I really never thought we would find such people ready to do the same here.’’