LAFAYETTE — Bill O’Malley, a longtime judge, district attorney, and defense lawyer who became the patriarch of one of the best-known families in the Bay Area’s legal community, died peacefully at his home Monday. He was 94.

A father of nine, O’Malley earned a law degree in his late 30s and played an important role in every part of Contra Costa County’s legal system. Besides spending nearly 20 years as the top prosecutor and a decade as a judge, he helped form the public defender’s office and was a partner in one of the largest local private firms.

Though he retired nearly 30 years ago, O’Malley was still a well-known figure in part because of his children: His daughter Nancy O’Malley is Alameda County’s district attorney, and his son Dan O’Malley is himself a former judge and current private attorney. His daughter-in-law Mary Ann O’Malley is also a Superior Court judge.

“He had a full life … thank God he passed peacefully and painlessly knowing he was loved by millions he met in his 94 years,” Nancy O’Malley wrote in a Facebook post on her personal page, announcing her father’s death.

Days before he died, Bill O’Malley refused dialysis treatment and went on hospice, Dan O’Malley said, adding that his father’s life ended on his own terms.

“The word was he was singing a nice Irish song when he expired,” Dan O’Malley said. “His kidneys were breaking down, but he was still sharp. He was playing Jeopardy Saturday night, and was working out on Thursday and Friday.”

Born in Boston in 1924, Bill O’Malley wouldn’t become an accomplished California lawyer for decades. At 16, he was kicked out of the Army when his age became known. Two years later, he joined the U.S. Navy with hopes of becoming a war hero.

“He ended up having a job at shore patrol near Fenway Park, 20 minutes from where he grew up,” Dan O’Malley said. “He was bummed about that, but he made light of it throughout the years.”

After the war, he attended Fordham University in New York and Boston College Law School, but dropped out to focus on raising his large family. In the 1950s, after the O’Malleys moved to California, Bill became an insurance adjuster and attended Golden Gate University’s law school at night. In his early 40s, he became an attorney and joined with a private practice that is now Gagen McCoy in Danville.

In 1968, his eldest daughter, Maura O’Malley, was killed by a drunken driver in Danville. That same year, Bill O’Malley was appointed district attorney, a position he held for 16 years. The county’s first rape crisis center was formed during his tenure, funded out of the district attorney’s office’s budget.

Current Contra Costa District Attorney Diana Becton, herself a former judge, said in a written statement she was “deeply saddened” to learn of O’Malley’s passing.

“I salute the memory of an exceptional jurist and former district attorney, remembered as a man with a passion for justice, who was loved and respected by many. My deepest condolences to the family of Judge Bill O’Malley,” Becton said.

O’Malley retired from the bench in 1994, and was present to see his son be sworn in as a judge seven years later. He broke away from law after his retirement, but remained active in other ways, traveling the world and become a historian and lecturer with a focus on World War I.

“Four years ago, he climbed one of the pyramids in Egypt,” Dan O’Malley said. “He was one tough sucker.”

Bill O’Malley is survived by his sister, Grace Fitzgerald; sons Jake and Dan; daughters Nancy, Denise, Betsy, Grace, Patty and Mary; as well as 13 grandchildren and six great-grandchildren. He was preceded in death by his wife, Claire. His funeral is scheduled for 11 a.m. Jan. 18 at Christ the King Church in Pleasant Hill.