Retired Navy Capt. Herbert Dudley Mills Jr., 58, whose last assignment involved work on behalf of prisoners-of-war and servicemen missing-in-action and their families, died Tuesday at Fairfax Hospital after a heart attack. He lived in Potomac.

Since retiring from the Joint Systems Command here in 1974, he had taught mathematics at Madeira School in McLean. He received the Legion of Merit for his work involving POWs and MIAs.

Capt. Mills was born in Cheshire, Conn.He graduated from the U.S. Naval Academy in Annapolis in 1946 and later earned a master's degree in mathematics at American University.

During his career at sea, he had commanded three ships, the Agile, a mine sweeper; the Basilone, a destroyer; and the Mahan, a destroyer leader. His shore assignments included serving as a Navy congressional liaison officer from 1957 to 1959 and as a military attache at the U.S. Embassy in Brussels from 1966 to 1968. He then returned to Washington, where he was with the Office of the Chief of Naval Operations before joining the Joint Systems Command.

Capt. Mills attended St. Elizabeth's Roman Catholic Church in Rockville. He was a member of the Bethesda Country Club.

Survivors include his wife, the former Gem Mitchell of Potomac; a daughter, Pamela Mills Brancaccio of Towson; a son, H. Dudley III, of Potomac; and his parents, Mr. and Mrs. H. Dudley Mills, and two brothers, Edward L. and Robert W., all of Cheshire, and a grandson.

The family suggests that expressions of sympathy be in the form of contributions to the Capt. H. Dudley Mills Memorial Fund, c/o the U.S. Naval Academy Alumni House, Annapolis, Md.