He was the eldest son of Thomas O'Hagan, the Lord Chancellor of Ireland in Gladstone's first two governments, and of Alice Towneley from Lancashire's prominent Towneley family, from whom he inherited considerable land holdings of some 5300 acres .