Three weeks ago, Mark Green seemed a good bet to be the next mayor, in a soporific race. Now he's playing Rudy and Freddy in a scintillating power-politics poker game.

On the most important day of his political life, Mark Green was, understandably, a little distracted. Sitting on a burgundy Art Deco-style sofa in the living room of his Upper East Side apartment, the usually relaxed, even cocky candidate was uneasy. He shuffled his feet. He rubbed his hands on his legs. And every time the phone rang, he looked up expectantly as a young aide took messages. * It was the middle of the afternoon on primary day -- still too early for the first exit polls, when he would learn that Fernando Ferrer was running a couple of points ahead of him. Visible through the window were ominous clouds that hung low over the East River.

For months, Green had campaigned with a comfortable lead in a race no one seemed to care much about. But in the last week before the primary, Green could see Fernando Ferrer gaining on him. And then, on the morning of September 11, everything changed.

The sleepy race was transformed into probably the most important -- and certainly the most bizarre -- moment in the history of New York politics. The primary was postponed. Campaigning was suspended. Mayor Giuliani, nearly killed in the first hour after the attack when the south tower came down, took charge completely (no surprise). But he also showed remarkable (this raised eyebrows) compassion, sympathy, and powers of unification.

Throughout the difficult weeks, Giuliani flourished, seeming to have perfect emotional pitch. Perhaps not unexpectedly, the city wanted him to stay. Slowly, he warmed to the idea. Even as the mayor was exhorting people to return to their normal lives and routines -- go to work, go to the movies, go out to eat -- his aides searched for ways to manipulate the rules and enable him to stay in office. Apparently the return to normal didn't include the democratic process. (At his press briefing the day before the primary, the mayor actually said, "People should go to the polls and vote. If they want to.")

Then things got stranger. Governor Pataki, who handled himself nicely during the crisis but never achieved the folk-hero status of Giuliani, did an astonishing double reverse. According to a source close to the mayor, the governor told the mayor's people when the issue first came up that he would support a move in the State Legislature to enable the mayor to stay on.

Then, perhaps after speaking with some key people in Albany, he changed his mind. Finally, possibly trying to look like a good guy or to make up for going back on his word to the mayor's people, he said just before the primary that if he were voting in the city, he'd write in Mayor Giuliani. Which he knew, of course, would be a wasted vote.

In this extraordinary atmosphere, it wasn't hard to understand Mark Green's uneasiness on primary day. And this was before he knew he'd finish an embarrassing second behind the surging Ferrer. But when I asked him whether he felt put upon, or as if he'd had some extraordinarily bad luck, he understandably refused to complain.

"The people who have been put upon are the families who lost loved ones," he said. "I feel very calm and focused about what I have to do, which is prepare for leadership and prepare to unite and rebuild this city."

Still, Green would have to be a saint not to feel that, as the world has been shaken, he's been knocked off balance, too. Put yourself in his shoes. You're a youthful 56-year-old politician, a Democrat who has spent several decades building an impressive résumé. You have a smart, attractive wife of 24 years whom you met (where else?) at a political fund-raiser during the Democratic convention in New York when you were both young activists, and two well-adjusted, photogenic kids.

You're a graduate of Cornell and Harvard Law School, where you were resourceful enough to be the editor-in-chief of an alternative publication called the HarvardCivil Rights-Civil Liberties Law Review, which is still going strong. You interned for Jacob Javits. But instead of showing your appreciation by unobtrusively doing a good job, you drafted a petition against the Vietnam War, got several hundred other Washington interns to sign it, and sent it to the president. Lyndon Johnson was so angry he actually defunded the intern program for three years.

Then you went out into the world, and instead of grabbing the big bucks (as your parents told you to), you signed on with Ralph Nader as an $11,000-a-year public-interest lawyer. You wrote books. You founded a liberal think tank. You worked as a policy adviser and speechwriter for Gary Hart. In 1980, you ran for Congress and lost. In 1986, you ran for Senate (as a "noble underdog," you like to say) and were crushed by Al D'Amato. You worked on the issues for Dukakis and Clinton. You mentored other bright young Democrats like Michael Waldman, who would go on to become Bill Clinton's chief speechwriter and the author of the book potus Speaks.

David Dinkins named you consumer-affairs commissioner. In 1993, you won a gimme election and became public advocate. Four years later, you were easily re-elected. And in 1998, you got hammered in the Democratic primary for Senate by Charles Schumer. Still, you never gave up. You never let down.

As public advocate, you continued to fight the good fight, tackling mob control of the trash-hauling business. The tobacco manufacturers. Police misconduct. Campaign-finance reform. Domestic abuse, child welfare, and a host of other populist issues. Cleverly, you also banged heads with Rudy Giuliani, becoming one of his favorite targets and keeping your name in the papers.

And now here you are, the loner of New York politics, the man with few political friends because you've spent the past ten years poking your finger in everyone's eye as the city's official public pest, about to get the big prize. But as you stood (as you love to say) "on the brink of becoming New York's 108th mayor," the favorite in the Democratic primary, with likely Republican opponent Michael Bloomberg reeling, the world turned upside down.

And the mayor, who had cast a long shadow over the race even before the Trade Center attack, now threatens to occupy the entire public stage. Even if he ends up not running, he has, at the eleventh hour, set a standard of leadership that may be impossible for anyone to live up to.

"People who are taken to be great leaders are almost always given the opportunity by history to deal with a crisis," says former governor Mario Cuomo. "Rudy said what he had to say and he said it perfectly. He did everything he could possibly do to give hope, to give reassurance, and to give some sense that this government knew what was happening and was doing everything it possibly could.

"So whether he's there or not, voters will be looking for Rudy. He's defined leadership, at least for the foreseeable future. And that means the candidates suffer."

Then there's the actual suffering of having to agree, as Green did last week, to let Giuliani -- a man he's often fought with bitterly over the past eight years -- stay on for an extra three months. (Michael Bloomberg also agreed. But Ferrer called the mayor's bluff, rejecting the proposal.)

Out of the blue, Green received a call last Wednesday afternoon asking if he'd come to the command center for a meeting with the mayor. With sundown and the start of Yom Kippur rapidly approaching, Green talked with the mayor in what one of his aides describes as a "very brief but cordial" sitdown in which the mayor asked for three additional months on the job to deal with the cleanup downtown.