SIDI BOUZID, TUNISIA — On the evening before Mohammed Bouazizi lit a fire that would burn across the Arab world, the young fruit vendor told his mother that the oranges, dates and apples he had to sell were the best he’d ever seen. “With this fruit,” he said, “I can buy some gifts for you. Tomorrow will be a good day.”

For years, Bouazizi had told his mother stories of corruption at the fruit market, where vendors gathered under a cluster of ficus trees on the main street of this scruffy town, not far from Tunisia’s Mediterranean beaches. Arrogant police officers treated the market as their personal picnic grounds, taking bagfuls of fruit without so much as a nod toward payment. The cops took visible pleasure in subjecting the vendors to one indignity after another — fining them, confiscating their scales, even ordering them to carry their stolen fruit to the cops’ cars.

Before dawn on Friday, Dec. 17, as Bouazizi pulled his cart along the narrow, rutted stone road toward the market, two police officers blocked his path and tried to take his fruit. Bouazizi’s uncle rushed to help his 26-year-old nephew, persuading the officers to let the rugged-looking young man complete his one-mile trek.

The uncle visited the chief of police and asked him for help. The chief called in a policewoman who had stopped Bouazizi, Fedya Hamdi, and told her to let the boy work.

Hamdi, outraged by the appeal to her boss, returned to the market. She took a basket of Bouazizi’s apples and put it in her car. Then she started loading a second basket. This time, according to Alladin Badri, who worked the next cart over, Bouazizi tried to block the officer.

“She pushed Mohammed and hit him with her baton,” Badri said.

Hamdi reached for Bouazizi’s scale, and again he tried to stop her.

Hamdi and two other officers pushed Bouazizi to the ground and grabbed the scale. Then she slapped Bouazizi in the face in front of about 50 witnesses.

Bouazizi wept with shame.

“Why are you doing this to me?” he cried, according to vendors and customers who were there. “I’m a simple person, and I just want to work.”

Revolutions are explosions of frustration and rage that build over time, sometimes over decades. Although their political roots are deep, it is often a single spark that ignites them — an assassination, perhaps, or one selfless act of defiance.

In Tunisia, an unusually cosmopolitan Arab country with a high rate of college attendance, residents watched for 23 years as Zine el-Abidine Ben Ali’s dictatorship became a grating daily insult. From Tunis — the whitewashed, low-rise capital with a tropical, colonial feel — to the endless stretches of olive and date trees in the sparsely populated countryside, the complaints were uniform: It had gotten so you couldn’t get a job without some connection to Ben Ali’s family or party. The secret police kept close tabs on ordinary Tunisians. And the uniformed police took to demanding graft with brazen abandon.

Still, the popular rebellion that started here and spread like a virus to Egypt, Libya and the Persian Gulf states, and now to Yemen and Syria, was anything but preordained. The contagion, carried by ordinary people rather than politicians or armies, hits each country in a different and uncontrollable way, but with common characteristics — Friday demonstrations, Facebook connections, and alliances across religious, class and tribal lines. This wave of change happened because aging dictators grew cocky and distant from the people they once courted, because the new social media that the secret police didn’t quite understand reached a critical mass of people, and because, in a rural town where respect is more valued than money, Mohammed Bouazizi was humiliated in front of his friends.

After the slap, Bouazizi went to city hall and demanded to see an official. No, a clerk replied. Go home. Forget about it.

Bouazizi returned to the market and told his fellow vendors he would let the world know how unfairly they were being treated, how corrupt the system was.

He would set himself ablaze.

“We thought he was just talking,” said Hassan Tili, another vendor.

A short while later, the vendors heard shouts from a couple of blocks away. Without another word to anyone, Bouazizi had positioned himself in front of the municipal building, poured paint thinner over his body and lit himself aflame.

The fire burned and burned. People ran inside and grabbed a fire extinguisher, but it was empty. They called for police, but no one came. Only an hour and a half after Bouazizi lit the match did an ambulance arrive.

Manoubya Bouazizi said her son’s decision “was spontaneous, from the humiliation.” Her clear blue eyes welled as her husband placed at her feet a small clay pot filled with a few white-hot pieces of charcoal, their only defense against a cold, raw, rain-swept day. The Bouazizi family has no money, no car, no electricity, but it was not poverty that made her son sacrifice himself, she said. It was his quest for dignity.

Ben Ali visited Mohammed Bouazizi in the hospital, along with a camera crew. The president made a show of handing Manoubya a check for 10,000 dinars (about $14,000). But the mother said Ben Ali’s staffers took the check back after the cameramen were escorted from the room. “I never got any of it,” she said.

Three weeks after he set himself on fire, Bouazizi died in the burn unit.

In early January, the policewoman was arrested, but it was too late. The story had spread, and three months later, a revolution that sprouted in a small village in Tunisia and flowered in Egypt has morphed into a contagion that threatens regimes in Bahrain and Yemen, has enveloped Libya in civil war, and is unsettling even the region’s more placid monarchies, such as Saudi Arabia and Jordan.

Slim Amamou, a blogger in Tunis, got a call from a friend.

“I’ve got some hot video,” the friend said.

On the day after the burning, one of Bouazizi’s cousins had used his cellphone to record the small crowd gathered in front of Sidi Bouzid’s city hall to protest how the vendors had been treated.

The cousin posted the video online, and Amamou saw it. The 33-year-old computer wiz, who had been blogging about the Ben Ali regime for four years, had to get the word out.

YouTube was a non-starter; Ben Ali’s censors kept close watch on the site. But Facebook’s growth had been so sudden that the censors had not yet placed any restrictions on it. Tunisia has the highest rate of Internet use of any Arab country.

Amamou posted the video on Facebook, and in a daisy chain of sharing, the images flashed into homes, offices and Internet cafes. Within two days, first in towns near Sidi Bouzid, protesters took to the street to shout for fairness, jobs and the prosecution of corrupt officers.

On the first evening after the video hit Facebook, al-Jazeera, the Qatar-based cable channel that is viewed widely through the Arab world, picked up a clip and broadcast it repeatedly. Tunisia’s state-controlled TV did not mention the incident for 12 days.

In the winding, narrow cobblestone alleys of the casbah, the medieval bazaar in the center of Tunis, acrid tear gas filled the air. Shopkeepers armed with broomsticks guarded their wares.

On the radio, DJs played Tracy Chapman’s 1988 hit “Talkin’ Bout a Revolution” over and over, and young activists squatting in tents on the main square sang along: “Finally the tables are starting to turn.”

Suddenly, shots rang out from overhead. Sniper fire. It’s the secret police trying to create anarchy, people said. No, others said, it’s crazy thugs who poured out of prison in the cacophony of the government’s fall. Whoever was shooting, the bullets were real, and the alleys of the casbah filled with people running away — or, in a few cases, toward the action.

It was March now, and although Ben Ali was far away in Saudi Arabia, nothing was settled. The police had disappeared, fearing reprisals from people suddenly free to shout back — or worse — at those who mistreated them. Ministers seemed to resign daily as protesters demanded the removal of all who propped up the old regime.

Five men hustled by carrying a bleeding boy, shot in the gut. As the call to evening prayer sounded from a nearby mosque, Seyfallah Machat narrated the scene into two cellphones.

“I’m in the casbah, live and direct, and people are bleeding,” he said, and in cars and homes around the country, people listened to a kind of reporting they had never before heard. A baby-faced former Boy Scout leader, Machat is 25, a reporter for Shems FM, a radio station owned by Ben Ali’s daughter-in-law.

Machat needed party connections to land this job, but he had no such ties when he was a student at the University of Tunis in 2007. Then, officials from Ben Ali’s ruling party saw Machat lead student meetings, liked his charm and asked him to run for student government.

When Machat declined, wanting to stay independent, party officials came to him with a state security report tagging him as a radical Islamist. Machat was a Muslim but hardly devout — he wouldn’t even pray with his parents. But he knew the report could suffocate his career.

The party delivered an ultimatum: Sign the report or run for office under the party ticket. Machat agreed to run, then withdrew from the campaign midway.

“I played the game with them to have some freedom,” he said.

Party officials were mollified enough by Machat’s cooperation that he was offered a job on state TV as host of a talk show for youths. But he grew disillusioned as censors cut out his most honest questions. He quit and got the radio job, but there was no more freedom there.

That changed on Jan. 14, after Ben Ali skipped town and the station’s owner vanished with the rest of the ruling family. Suddenly, reporters could tell the truth.

“Every family here has somebody who lost a job or was denied a raise or was called in by state security,” Machat said. “Bouazizi just gave us the courage to let it out.”

In Tunisia and then in Egypt and across the region, people who had complained only to friends and family felt the fear that their rulers depended upon dissipate like air from a pierced balloon. The wizards who commanded seemingly omnipresent secret police forces were revealed to be just old men behind a curtain, running state security operations that didn’t even know how to handle a virus of rebellious Facebook pages.

Two months later in Tunis’s main square, Machat, microphone in hand, gave voice to people who have created 60 political parties in just six weeks.

A taxi crept through the crowd, its radio blaring a song that has become an anthem of the revolution. The people joined in with folk singer Amel Mathlouthi: “I am those who are free and never fear. I am the secrets that will never die. I am the voice who would not give in. I am free and my word is free.”

In the days after the revolution in Tunisia, Egypt’s state security agents were on high alert. They knew whom to watch. They’d been onto Ahmed Maher for a long time. They’d tapped his phones, recruited informants among his friends, plugged into his e-mail. They knew he was planning something far bigger than the marches of a few dozen people he’d organized in recent years.

But Maher, 30, was smarter this time. He stayed off e-mail and his cellphone so the authorities couldn’t track him. And he worked through Facebook, a phenomenon that seemed to mystify the secret police. (The last time they took him into custody, they asked Maher questions about people who had commented on his Facebook page, apparently thinking he must know every random person who had left a posting.)

In the past, Maher, a soft-spoken civil engineer who looks as if he’d be more at home in a design studio than a demonstration, had spent much of his energy persuading Egyptians that they could speak out against Hosni Mubarak without sacrificing their careers. This time, he had Tunisia on his side.

“Everybody said, ‘How come we’re not like them?’ ” Maher said. “We’d just been waiting for something to trigger us.”

The contagion of revolution has a way of wiping away differences that usually divide people. History has provided evidence of the phenomenon again and again, in years that became shorthand for waves of change — 1848, 1989, and now, in the Arab world, 2011. In each case, corrupt regimes fell to people who suddenly felt free to push back. Stifling job markets, near-absolute political power and a frustrated middle class combined to create a perfect storm in which formerly divided classes joined to rise up against their rulers.

In many revolutions, the tools of oppression seem to crumble in an instant. But no one can be sure in the moment. In Egypt, the security service had foiled Maher before. Back in 2008, they’d read his blog every day as he planned a general strike to protest Mubarak’s regime.

On the morning of the strike, “the security apparatus arrested everyone I knew,” Maher said, erasing the protest before it could start. The authorities caught up with Maher one morning soon thereafter. Unmarked cars surrounded him. Agents blindfolded Maher, tied his hands and beat him with fists and batons.

“You think you can hide from us?” an agent said. “We can make you disappear.”

Before they let him go two days later, Maher had suffered electric shock and beatings — and then the agents pivoted. “You can be head of a small political party,” a “good cop” promised. “We can be friends.”

Maher instead announced his ordeal to the world. He resumed blogging, writing about educated Egyptians who couldn’t get work because they lacked connections, about censorship, about corruption such as that which initially drove him to activism: At his first job, he was crushed to learn that his design firm’s plans for modern roads would be ignored because public contracts went to the president’s cronies.

Now, Maher watched the news from Tunisia as it hopped across hundreds of Facebook pages. He decided to capi­tal­ize on the moment, recruiting friends to help plan the first big protests in Tahrir Square, the sprawling traffic circle between Cairo’s colonial-era downtown and the banks of the Nile. They used Facebook to consult with Tunisians, learning how to defend themselves against tear gas (vinegar and Pepsi, applied to the eyes) .

It was all about momentum, Maher believed. If the crowds kept growing, the pressure on the regime would become unbearable. They picked a day to strike — Jan. 28. To disperse the police, he devised a plan to enter the square from a dozen directions.

That afternoon, a precision-choreographed procession headed toward the square, new groups joining at every turn. In Imbaba, a working-class section of mid-rise apartments, women leaned out windows banging pots and pans. Along the way, police tear-gassed the marchers, yet at each intersection, new arrivals were moved to the front to relieve those already hit with gas.

Maher stayed at the square for 18 days, on the street and at the operations center, an impossibly crammed office in an art deco building. He left only once, to see his daughter on her third birthday; on that day, police raided the operations center, arresting nearly everyone.

Night after night, Maher sat knee to knee with people from across Egypt’s invisible boundaries, Marxists and wealthy people and devout Muslim Brotherhood members.

He was surprised to see that some Islamists — which make up Egypt’s only large, organized opposition — were not radical terrorists but frustrated young men hungry for change.

“For years, the Egyptian voter only had two options — a corrupt regime or us,” said Abdel Moneim Abou el-Fotouh, a leader of the Muslim Brotherhood youth movement. He relished walking through the crowds at Tahrir Square to see sheltered religious men in deep conversation for the first time with intellectuals, secular people and others they had formerly shunned. “Now they will have five or six choices, and they are already falling away [from the Brotherhood] in great numbers.”

Those heady days of January created a contact high of optimism. But now, as Egypt’s military rulers work toward elections, many groups that met on the square have returned to their own corners — intellectuals at smoky cafes, Islamists at their spare offices, the upper middle class at the country clubs along the Nile. Back among their own, they worry that the instability that revolution brings will prove difficult to reverse.

The Gezira Sporting Club is an oasis of green, privilege and calm — probably the only spot in Cairo where rules against honking your horn not only exist but are obeyed — across the bridge from the defiance and daring of Tahrir Square. Created by British military forces that firmed up control of Egypt in the early 1880s, the club was a place where, as a 1923 guidebook put it, “the natives are not welcomed.” Today, Egyptians run the place, but there remains an air of exclusivity. Waiters tend to parents who relax poolside as hard-driving coaches time their children’s laps.

Like many at the club, Ali Abdel Ghaffar, 42, a real estate developer, spent the revolution simultaneously cheering on the protesters and worrying if regime change might blow up his comfortable life. He went to the square once, just to see the scene, and then went home to join neighbors guarding their housing development, since the police had vanished.

Ghaffar did well under the old regime, progressing through high posts at foreign enterprises Mubarak had courted for Egypt. Ghaffar was an executive at Egyptian branches of General Motors, Pepsi, Coca-Cola and Kodak.

By the time Ghaffar went out on his own, selling houses in gated communities on Cairo’s sandy edges, he was part of a system that now stands accused of corruption.

“Billions and billions were kicked back to people in the housing ministry,” Ghaffar said. “I never bribed anyone, but the culture was one of ‘baksheesh’ ” — of favoritism and bribery.

These days, “I go to work and nothing’s happening,” Ghaffar said. “No one’s coming to look at properties. There are no police. We’re trying to live our normal lives, but it’s like someone opened a smelly can of worms and now we have to deal with that.”

The poolside talk is about whether it’s safe for the kids to go to school, and about members of the Mubarak family who still come to the club, though some will no longer look them in the eye. Yet life goes on — girls who don’t cover their hair run drills on the hoops court, and girls who do chatter happily on the tetherball courts.

Ghaffar expects years of disarray, but in the end, he said, “Egypt will become another Turkey, an Islamic country that knows how to do business and be tolerant. I love Turkey. There’s beer in the pubs and moderate Muslims in the government. If it doesn’t work here, maybe we’d move there.”

Maher sees Egypt turning into a battleground — of ideas, but now also of fists and guns.

“I miss the square,” he said, and he’s determined to keep his movement alive. “We’re studying pressure groups now, looking at a group in the States. They are called the tea party.”

Fifteen hundred miles from Mohammed Bouazizi’s fruit cart, in the gentle hills above the Jordan River, a swelling tide of complaints about corruption, the secret police, rising prices and privatization of public services has led not to revolution but to a slow drip of small protests.

In Jordan, Muhammed al-Sunaid worked for years without complaint — like Bouazizi — without any prospect of improving his family’s lot. And like the Tunisian who inspired Arabs to rise up, Sunaid, who drove a bulldozer for the farm bureau, reached a breaking point.

Last spring, Sunaid, 34, traveled from his mud hut on the crest of a hill overlooking barren fields to the nearby market town of Madaba. He hoped to appeal to Jordan’s agriculture minister to consider the plight of his neighbors who pay rent of 100 dinars (about $140) a month but earn only 90 dinars.

Police blocked Sunaid before he could enter the place where the minister was to speak. As Sunaid called to the minister, he was cuffed, muzzled and hit — in front of 200 friends and neighbors.

Humiliated, Sunaid insisted on filing a complaint against the officer who hit him. Instead, he was sent to a secret court, which sentenced him to three months for insulting a public official and “causing a din that robs locals of their peace.”

When a group of retired military generals in Amman, Jordan’s sprawling, modern capital, heard about the budding revolt in the struggling countryside, they embraced Sunaid’s case, hoping it might inspire popular demand for reform.

Jordan, a country with no oil and few natural resources, “has always had poor people, of course, but the gap in incomes was nowhere near as great as now,” said Ali Habashneh, a retired general. “In recent years, the Royal Court has been closed to the people. The corruption is in plain view. We feel great danger coming.”

But Sunaid’s story, though widely told, produced no great uprising. Sunaid himself seeks only reform, not regime change. If King Abdullah II would visit the people and hear their stories, he would surely act, Sunaid said.

It is a refrain heard from the gleaming office towers of West Amman to the fraying old British colonial downtown in the city’s east, from corporate executives to the lowliest tea boy — if only the king knew what was really happening, reform would come. In the Royal Court, advisers say Abdullah is aware of the protests and plans to liberalize election laws this year, giving more power to voters.

At Amman’s small protests, that promise is denounced as inadequate, yet even the loudest protesters carve out a sacred space for the king. That reticence to criticize the monarch may reflect the fact that insulting the king is a crime in Jordan, but so is gathering a crowd without a permit, and people are increasingly brazen about breaking that law.

Jordan’s police, compared with Tunisia’s and Egypt’s, are not menacing. They hand out refreshments to protesters — juice boxes, water, nuts. In turn, protesters express fealty to the king. That reflects in part nostalgia for King Hussein, Abdullah’s father, whom many see as the creator of modern Jordan, and in part a common view of the monarchy as a deeply divided nation’s binding force.

In a country of 6 million, about half are Palestinians from the Jordan River’s West Bank and half are East Bankers, mostly of tribal background. Although many Palestinians carry Jordanian passports, few are citizens. Any discussion of expanding democracy in Jordan starts and stops with that question: What to do with the Palestinians? And then you’re on the prickly turf of the Arab-Israeli conflict.

“And that is why the king is still sacred in Jordan,” said Basil Okoor, managing editor of Ammon News, a Web site that is gaining popularity — and scrutiny from state security — for its frank reporting. “We have two major identity groups and a lot of anger. The only thing that can save Jordan from a great deal of fragmentation is the monarchy. ”

Outside the Royal Palace one morning this month, hundreds of poor people appeared, taking the authorities by surprise. Traffic into Amman was snarled from every direction. Men and women in tribal garb — headdresses, long gowns and sandals, even in a cold, raw rain — pressed against each other on narrow sidewalks. Nearly everyone had a sheet of paper in hand, a photocopied application to the king.

“To His Majesty,” it said. “This subject seeks your help. My Master, I am very poor and I have a large family composed of . . .” — and then there was a blank for the supplicant to list dependents. “We have no one to supply us except God and Yourself.”

For hours, they arrived, and then cries and shouts swept through the crowd: There would be no handouts. It was all a rumor, spread the old-fashioned way. No Facebook, just gossip from people who heard from someone who knew someone who got 200 dinars (about $280) from the king.

Tafesh Hassan, a regal-looking man with sun-dried skin, raged as he recounted giving a taxi driver a quarter of his monthly disability benefit to get there.

“I cannot work,” he said, and he pulled down his pants to display a surgical scar. “Why do they humiliate and degrade us? My house has no pillars, nothing to hold it up anymore. We love the king, but those under him are corrupt. The ministers, they have no fear of God.”

A state security agent heard Hassan and chastised him: “No one in this country is poor. Everyone is taken care of by the Royal Court.”

After the agent walked away, Hassan wept. In a lowered voice, he said, “King Hussein would have come out to talk to us.”

Naziha Sawalha, 46, a widow raising seven children, paid two months’ salary for a taxi. “The whole village came, and now there is nothing,” she said.

She’s been following the news from Egypt, but she said no such uprising could happen here.

“We are under the patronage of his majesty,” she said. “The government gives us what we deserve.”