Joseph Freitas Jr., who as San Francisco's district attorney modernized the office in the late 1970s during one of the most tumultuous times in the city's history, died Wednesday.

The 66-year-old Freitas succumbed to lung cancer at the American Hospital in Paris, the city he made his primary residence after the death of his French wife last year from bone marrow cancer.

During Freitas' four-year term, the city was wrenched by two events -- the 1978 Jonestown suicide-murder of hundreds of followers of Peoples Temple cult leader Jim Jones, who had presided over a Fillmore district church, and nine days later the assassination of Mayor George Moscone and Supervisor Harvey Milk at City Hall.

Friends lauded Freitas as a man who brought the district attorney's office into the modern age, beefing up its consumer fraud unit, bringing large numbers of minorities and women onto what had been a predominantly white male staff, increasing the number of prosecutors and creating many innovative programs, including victim counseling, that continue today.

But none of his friends and associates attempted to dismiss one undeniable truth about Freitas: His dream of climbing higher in political office was snuffed out on May 21, 1979, when a jury rejected a first-degree murder conviction for ex-Supervisor Dan White and instead found him guilty of two counts of voluntary manslaughter in the City Hall killings of Moscone and Milk.

Try though he did in the years that followed, Freitas never could distance himself from the verdict, which stunned the city and set off what became known as the White Night riots in which crowds of demonstrators burned police cars and stoned City Hall.

As district attorney, Freitas had decided not the handle the trial himself and instead turned it over to a veteran deputy.

"When that verdict occurred, he was devoured by it politically," recalled Jeff Brown, the city's former public defender. "He saw himself as a political comer and was looking at the attorney general's race and the mayor's race, but the Dan White case brought an end to all of that."

One of Freitas' top deputies at the time, Dan Weinstein, who went on to become a Superior Court judge, remembered later that he was watching Freitas from the rear of the courtroom on the day that the White jury announced its verdict on the 1978 killings.

"All I could see was Joe's back," Weinstein recalled once. "I watched the court read the verdict. I saw Joe's shoulders slump, and I thought, 'Oh man, is this guy in trouble.' "

Freitas' description of that day was blunt: "It was," he said, "probably the worst day of my life."

Twice more Freitas would try for political office -- once for re-election to a second four-year term as district attorney in 1979 and again in 1992 when he ran for a state Senate seat against longtime incumbent Milton Marks. Both times Freitas lost by huge margins.

"I cried my eyes out because I knew it wasn't a just verdict," Freitas said of the White case in a 1992 interview, "and it was going to present problems for my political survival. The public needed to have a boil to lance, and they took it out on the D.A."

Evaluating what had happened to Freitas, Jeff Brown said, "This was a man of tremendous ability, a great speaker, good-looking, smart as a whip. He was philosophical about what happened to him -- understanding the city was right at the turning point of transformation from an old San Francisco to a city with large gay and minority voting blocs. He was elected on the basis of that transformation, but when the verdict occurred, he was destroyed by it because the liberal voting bloc didn't accept any of the explanations he offered."

When campaigning for district attorney, Freitas had pledged to prosecute major cases -- so why, he was asked in an interview, hadn't he prosecuted White himself?

"It was clear that this was one of the most horrible murders in the city's history," said Freitas, who had been a labor lawyer active in Democratic politics before his election. "I knew all three participants -- Moscone, Milk and White. I didn't want anyone to say Freitas is using the case for personal political reasons."

Such explanations didn't mollify the critics, who lashed out at him, saying that his office had allowed a jury to be selected that was more sympathetic to White than to the prosecution.

Because of the role he played in the White case, any recounting of Freitas' career inevitably opens the book on one of the most painful passages in the history of San Francisco.

White was a former police officer and an ex-firefighter with strong roots in the city's Irish Catholic community and a conservative record. He smuggled a gun into City Hall on Nov. 27, 1978, and killed Moscone and Milk, one of the country's first openly gay politicians, after it became apparent that the liberal mayor would not reappoint him to the supervisor's post White had relinquished, saying he needed more money than a $9,600 supervisor's salary to support his family.

White's lawyer, Doug Schmidt, effectively used the financial and family pressures on White to help paint a portrait of a 32-year-old, good-hearted man incapable of the premeditation and deliberation that the law required for a jury to find White had committed murder. The voluntary manslaughter verdict returned by the jury only required an intent to kill.

The Dan White case wasn't Freitas' only political burden.

When he ran for re-election, he was attacked by critics who said his office had failed to uncover what was really going on with Peoples Temple cult leader Jim Jones, who held forth in a Geary Boulevard church and had supported many city politicians, including Freitas.

In 1978, Jones persuaded followers to go with him to a parcel of land he called Jonestown in the jungles of Guyana. There on Nov. 18 of that year, more than 900 of Jones' followers died with him in a mass suicide-murder in which some drank or injected a poison potion and others were shot.

In the political finger-pointing that followed that tragedy, Freitas was criticized for having hired Tim Stoen, one of Jones' lieutenants, to be one of his top deputies in the district attorney's office. When running for re-election in 1979, Freitas argued that the state attorney general's office had investigated his employment of Stoen, who later defected from the cult and became a bitter Jones critic, and found no irregularities.

In his campaign, Freitas spoke of an improved handling of criminal cases and a tough focus on violent and white-collar crime. He also said his office had the responsibility to take action in street prostitution cases where the city's neighborhoods or commercial life were being disturbed -- a clear attempt to take a tougher stand than he did early in office when he said his office would not go after consensual, nonviolent behavior between adults.

Voters, faced with a choice between the politically damaged Freitas and moderate candidate Arlo Smith, elected Smith by a 3-1 ratio.

In 1985, almost two years after his release from five years in state prison, White killed himself by inhaling carbon monoxide in his garage. The year before he died, he confided to a close friend, homicide Inspector Frank Falzon, that he had intended to kill two other politicians along with Moscone and Milk -- Assemblyman Willie Brown and Supervisor Carol Ruth Silver -- because he blamed all four for Moscone's refusal to reappoint him.

After Freitas' ballot box defeats, he went back to the practice of law, specializing in labor cases, mediation and arbitration.

Freitas was the father of four children from his first marriage that ended in divorce. About 10 years ago, he remarried, this time to Douce Francoise. They divided their time between a home in Paris and an apartment in San Francisco until her death last year.

Freitas was born in 1939 and grew up in the small Merced County town of Atwater in a middle-class, Catholic, Portuguese family headed by his postmaster father, whom friends described as smart and very political. Freitas briefly entered a seminary in Fresno and but then decided on a secular education and received a bachelor's degree from San Jose State University in 1961. He received a law degree from the University of San Francisco in 1967. From 1959 to 1965 he was in the U.S. Marine Corps Reserve.

In 1967, Freitas was a staff director for the Bay Area Urban League when he was selected as a White House fellow. He also published the Washington Monthly, served as an associate director of the National Urban Coalition and went on to be Northern California campaign manager for John Tunney's successful campaign for the U.S. Senate in 1970. In 1972, he worked on U.S. Sen. Edmund Muskie's unsuccessful campaign to become president. In the early 1970s he worked as a West Coast director of Common Cause.

In 1975, he defeated incumbent John J. Ferdon by 10,000 votes to become district attorney at the age of 36. Looking back at his career years later, Freitas told one reporter that while he had accomplished much as district attorney, "Everything else was overshadowed by Dan White. And that's why it is so frustrating." But at another point, he added that while the criticism about the White case was hard to deal with, "Do you want to live a life of irkedness? You have to learn to live with it and move on with your life."

Until very recently, friends said, Freitas appeared vibrant and full of life, spending time in Parisian cafes, serving on charity boards, and looking forward to new adventures.

Freitas is survived by his children, Matthew Freitas of Amarillo, Texas, Clare Freitas of Albany, N.Y., Clementine Freitas Cowie of Golden, Colo., and Joshua Freitas of San Francisco. Family friends said Freitas would be buried in Paris in a plot next to his wife. They said a memorial service will be held later in San Francisco.

Mayor Gavin Newsom ordered City Hall flags flown at half-staff today, saying Freitas worked "with tireless commitment to the city he loved and the people he served."