He was a son of admiral and cabinet minister Henrik Steffens Hagerup (1806–1859) and Nicoline Christine Jenssen (1808–1862).
In social policy, Hagerup's time as Prime Minister saw the passage of a child care law in 1896 that increased the power of local authorities and courts over neglected and abused children.
Following his two bouts as Prime Minister, he served as ambassador to Copenhagen, The Hague, and Brussels.
In 1920 he led the Norwegian delegation when the League of Nations convened for the first time in Geneva.
In 1888, he founded Tidsskrift for Retsvidenskab (Journal of Jurisprudence), and served as its editor until his death.
He died in Kristiania (now Oslo) and was buried at Vår Frelsers gravlund.