Hagert was born on May 2, 1826, in
Philadelphia,
Pennsylvania. He graduated from
Central High School in 1842 and studied law under
Charles Gilpin. He was admitted to the bar on May 8, 1847, and worked as solicitor for the Board of Guardians of the Poor of Philadelphia. His work caught the attention of Philadelphia district attorney
William Bradford Reed and after the
consolidation of the city in 1854, he was appointed assistant city solicitor. Hagert served as district attorney in 1856–1857, 1868–1871, 1875–1878, and 1878–1881. He was especially distinguished as a
nisi prius lawyer. He was elected as a member to the
American Philosophical Society in 1875. He died of
Bright's Disease in Philadelphia on December 18, 1885 and was interred in
Laurel Hill Cemetery. ==Legacy==