William Henry McGrath, 86, who dispensed wit, wisdom and compassion during his 12 years on the bench before retiring in 1971 as chief judge of the old Peoples Court of Prince George's County, died Dec. 24 at Prince George's General Hospital after a heart attack. He lived in Mitchellville, Md.

In addition to his career on the bench, Judge McGrath served as a Democrat in the Maryland House of Delegates from 1946 to 1950, was mayor of Seat Pleasant from 1940 to 1942, spent 13 years as a D.C. police officer, and was a decorated veteran of both world wars.

But it was on the bench that he became something of a legend. He presided over his court with a salty-tongued flair and became known among observers for some "standard" quips everyone seemed to enjoy. If an attorney became too long-winded explaining a document being submitted, Judge McGrath was known to interject: "I can read and write and count to 10." After fining a defendant, he directed payment in the form of "cash on the barrelhead."

In an era when many judges became type-cast for their findings, he found time to strive for the illusive goal of simple justice. He would frequently signal inexperienced attorneys (both prosecutors and defenders) when they ought to object and sometimes make the objections himself.

He was the author of a publication advising defendants of their legal rights and he organized the county's traffic school. He also headed the state bar committee that urged creation of the new statewide lower court system that replaced his own court.

In a 1971 interview with The Washington Post, one Maryland state trooper told of his respect for the judge. He said, "If you can testify before Bill McGrath in Prince George's County, you can testify before God on Judgment Day."

Judge McGrath was a native of Highland Falls, N.Y. He attended Columbia University and graduated from George Washington University's law school. He earned the Purple Heart Medal while serving with Army in France during World War I. After the war, he served a short time in the Marine Corps. During World War II, he served as a provost marshal with the Third Army of General George S. Patton Jr., and commanded a prisoner-of-war camp in France. He earned the Bronze Star Medal during that war and retired from the Army Reserves in 1958 after attaining the rank of lieutenant colonel.

He was in Washington by the 1920s and, in addition to his years on this city's police force, was for a time an assistant city corporation counsel. He also had engaged in the private practice of law in both Washington and Maryland and served at various times as a lawyer for the liquor and zoning appeals board in Prince George's County. He also had owned and operated a dairy farm in New York state before returning here in 1955.

Judge McGrath was a charter member and past president of the Seat Pleasant Lions Club and also had been active in the American Legion and Veterans of Foreign Wars.

His first marriage, to the former Jean Helbling, ended in divorce. His second wife, Elizabeth B., died in 1975.

Survivors include two children by his first marriage, a son, Paul L., of Silver Spring, and a daughter, Jean M. Hartley of Seaford, Del.; a stepson, William I. Heath of Clinton, Md.; a sister, Flora Richards of Binghamton, N.Y.; eight grandchildren, and nine great-grandchildren.