New York — At first, Joshua Colangelo-Bryan didn't know whether his client was a terrorist. Jumah al-Dossari had been rumored to work with Al Qaeda and to have fought for Islamic causes around the world. His name was familiar to anyone following the news after 9/11.

But Mr. Colangelo-Bryan, a Manhattan corporate litigator doing pro bono work for Mr. Dossari, needed more: "Certainly I'm not going to conclude that someone is a terrorist on the basis of Google," he said. He'd faced accused war criminals before, working with the United Nations on the prosecution of war crimes in Kosovo. But Guantánamo, the US naval station in Cuba where detainees in the war on terror are held, was new territory.

"This kind of offshore penal colony is not something that we do very often," he says. He was drawn initially to the legal challenge – "the novelty and cutting-edge aspect of it. There was also what seemed like the fundamentally unfair notion that the government was holding people just because it said they should be held, without any form of due process … so there were important principles at stake."

Still, the first time he flew to Cuba to meet his client, he didn't know what to expect: "I walked into this little room for my first-ever meeting with a Guantánamo Bay detainee, worrying maybe I was going to have some lunatic jump across the table and try to choke me. Instead, there's this slight, smiling, shackled man sitting there who introduces himself as Jumah, and within 10 minutes, we're talking about the fact that his favorite movie is 'Jumanji.' "

Colangelo-Bryan was one of roughly 500 lawyers, many of them private attorneys working for no fee on the cases of Guantánamo detainees. They may be the most unpopular defense lawyers in America. They're harassed on the phone, get hate mail and e-mail, and some get death threats.

They've also come under fire from Liz Cheney, daughter of former Vice President Dick Cheney, whose political action committee recently released a Web ad implying that Department of Justice lawyers with prior experience defending detainees sympathized with terrorists. The ad calls them "the Al Qaeda-7" and questions the loyalty of the entire department, asking, "DOJ: Department of Jihad?"

Prominent conservatives have criticized the ad, saying in an open letter, "The American tradition of zealous representation of unpopular clients is at least as old as John Adams's representation of the British soldiers charged in the Boston massacre."

Indeed, the right to due process implies that someone has to defend the "bad guys." The Rosenbergs, executed as traitors in 1953, had lawyers. In 1977, the neo-Nazis of Skokie, Ill., had Aryeh Neier, a Jew who saw himself as defending free speech.

Due process admits something that the court of public opinion, in the heat of the moment, may not: The "bad guys" may not be who everyone thinks they are. That's possible even in Guantánamo Bay: Of the 779 imprisoned there since 2000, 705 have been released or cleared for release. Of those remaining, 30 are scheduled to be prosecuted.

• • •

When Colangelo-Bryan opened the files, he didn't see much to prosecute. "There were no transcripts of phone calls that had been intercepted involving [Dossari]. There were no photographs of him with [Al Qaeda leader Osama] bin Laden. There were no fingerprints on incriminating materials. There was really nothing that any judge would consider reliable evidence," he says.

The young Saudi father and office worker had been arrested while traveling through Pakistan and was turned over to the US military on vague allegations about participating in the "war on terror." Colangelo-Bryan set out to prove Dossari hadn't – but in the end, he didn't need to. Dossari would not face trial.

"It happened almost immediately," Colangelo-Bryan remembers. He and his client, one of the men Defense Secretary Donald Rumsfeld described as "among the most dangerous, best-trained, vicious killers on the face of the earth," became friends.

Early on, they met in a hut; Dossari was shackled and chained to a bolt in the floor. They told jokes, talked about women, shared childhood stories. Colangelo-Bryan brought news from Dossari's family, with whom the lawyer communicated often about the case. Sometimes they spoke through a translator, and sometimes in English, one-on-one.

Once, Colangelo-Bryan brought cheesecake from Junior's, the famous New York bakery. Dossari teased his lawyer about being too serious, about being single, about being cheap. When Dossari learned how little Colangelo-Bryan wanted to spend on an apartment, he called him a "tightwad."

As the friendship grew, the lawyer's life became more difficult. "It was the first thing I thought about in the morning and it was the last thing I thought about at night. And I certainly thought about it for much of the day," he says of his preoccupation with legal tactics, media strategy, and diplomacy.

He also worried about Dossari's mental health. Dossari, he says, tried to commit suicide at least a dozen times in Guantánamo. Once, Colangelo-Bryan discovered him hanging by his neck and bleeding from a gash he'd cut in his arm.

"This wasn't just an academic exercise where principles were being violated with indefinite detention," he says. "This was happening to someone who I became friends with, whose family I came to know."

Baher Azmy also found his first Guantánamo case – Murat Kurnaz, a German 19-year-old picked up in Pakistan in 2001 and released from Guantánamo in 2006 – increasingly personal.

Today, Mr. Azmy – director of Seton Hall University's Civil Rights and Constitutional Litigation Clinic, in New Jersey – is on the legal team for Abu Zubaydah, the Al Qaeda suspect waterboarded by CIA interrogators and now held at Guantánamo. He takes detainee cases "because I'm quite romantic about constitutional ideas," he says. "I perceived that what the government was doing was novel and extraconstitutional…. In the absence of law, it was just pure discretion and power and will. And I think I found that morally offensive."

That abstract commitment "turned into an all-consuming personal commitment," Azmy says, as he got to know Mr. Kurnaz and his family.

Azmy made five trips to Guantánamo. And once, when he was told his client refused to see him, he says, "I was completely devastated. I thought maybe something bad had happened to him, that he had lost his mind, that maybe a hyper-religious imam had gotten to him, or maybe he had given up, or maybe he was mad at me, or I'd messed up."

Because so much about the legal proceedings is secret, the media have been the court of best alternative for lawyers to get their clients a public hearing. But media appearances also incur some backlash.

"I have my name in the paper every now and again as someone associated with the representation of Abu Zubaydah, and when it does, I get angry e-mails. It happens as sure as night follows day," says Joe Margulies, another lawyer representing Mr. Zubaydah. "Some of them say very uncharitable things about me and my family. A lot of them say I'm a bad Jew. OK, fine. I don't lose any sleep over that."

Colangelo-Bryan says the difficulty is judging the severity of messages such as those urging him to "watch your back" or calling him a traitor. (Once someone told him that they "lived in a place where people know how to deal with traitors.")

"I remember seeing someone in an [Internet] chat room … talking about … how sorry they were that my client's suicide attempt didn't succeed … [and that] 'we should throw the lawyer in with him.' It's certainly disconcerting when you don't know where they are. You don't know to what extent they're just doing an Internet rant or to what extent there's something more substantive to it."

Guantánamo lawyers have also found supporters. Some aren't so helpful – lawyers' phones are convenient hot lines for conspiracy theorists. Others simply want to express appreciation for their work. And some even help the clients.

"I remember one time getting an e-mail from someone who said she was a nun," Colangelo-Bryan says. She'd read about Dossari's suicide attempts and subsequent hunger strike and said she was so moved by his plight that she'd fast in solidarity with him. "This was a story I told him, and that, to this day, he remembers as if I just described the e-mail to him."

• • •

Guantánamo cases are litigated in judicial limbo.Much of the evidence against the accused is classified, and lawyers aren't allowed to discuss what they've seen. Mr. Margulies describes "a yawning chasm between what some commentators and former government officials say and what I know to be so. And I cannot bridge that chasm because I'm bound by agreements not to disclose information."

In fact, detainee lawyers must turn over their notes to the government when they leave Guantánamo. Notes are stored at an undisclosed secure location; when lawyers need to write briefs on the cases, they must travel to Virginia and type on government computers.

It's impossible to talk about the legal guilt or innocence of most detainees. Two pleaded guilty before military commissions; one was tried and found guilty; a third faces criminal charges for involvement in two 1998 US embassy bombings.

Still, the question of guilt troubles some lawyers. Dossari was rumored to be an Al Qaeda recruiter in Buffalo, N.Y., a jihadi in Chechnya, a member of a Muslim fighting force in Bosnia. No formal charges were ever filed. Colangelo-Bryan says that the dearth of charges – and evidence – is a relief to him. The government dropped its only accusation against Dossari – that he'd been present at Tora Bora, an Al Qaeda enclave in Afghanistan – before it went before a judge.

Azmy says he's less attached to the case of Zubaydah, in part because there's better evidence against him. However, Azmy says most public information about Zubaydah "is shockingly, wildly, dizzyingly wrong and overstated, and the government's basically admitted that."

Azmy suggests that the Zubaydah story may play differently around the country: "I live in New York, so people are focused on the fact that he was waterboarded" and less on the question of guilt. "If I lived in Lubbock, [Texas,] I suspect people would assume that there had to be a reason for him to be waterboarded."

The bigger issue, Margulies says, is not to think categorically. "We don't make judgments about 'all those people.' A hundred years ago, it was all those Catholics, and another time it was all those black people, and ... all those Japanese people," he says. "If you want to hold somebody, in court you demonstrate that this person, not 'all those people,' has done something that justifies continued detention.... That's what we call judicial review."