Gregory, William (1762–1840), public servant, was born in February 1762 in India, youngest of three surviving sons of Robert Gregory (1727–1810), who was later chairman of the East India company and a British MP, and his wife Marie, daughter of Arthur Auchmuty. Educated in England at Harrow and Trinity College, Cambridge, he graduated BA (1783) and MA (1787). Originally intended for a legal career, he entered the Inner Temple (1781), but although called to the English bar (1788) he does not appear to have practised. The disgrace of his two brothers may have influenced his development: his elder brother Robert was disinherited because of a gambling addiction, and Richard was disgraced in 1793 after a court-martial for dereliction of duty. Tending his father's extensive estate at Coole Park, Co. Galway, William only entered politics in 1795 when he was appointed surveyor of Skerries in the administration of Lord Fitzwilliam (qv); at this time he held liberal opinions. In 1799 he became high sheriff of Galway, before serving briefly (Jan.–Aug. 1800) in the final Irish parliament as MP for Portarlington, Queen's Co. (Laois). His support for the union, or his father-in-law's influence, may have secured him the position of secretary to the board of inland navigation in 1800. On the death of his father in 1810 he succeeded to the Galway estates, and continued with minor roles in the Irish administration.
He rose to prominence when the lord lieutenant, the duke of Richmond (qv), impressed by his immaculate manners, appointed him under-secretary to the civil department (5 Oct. 1812). The new chief secretary, Robert Peel (qv), recognising his ability, soon delegated important decisions to him. When the under-secretary to the military department resigned in 1819 the posts were united with Gregory as first holder of the new office. As under-secretary (1812–30) he was the chief permanent official in the Irish administration and handled much of the business of government; his liberal opinions had given way to a ruthless determination to maintain law and order, and a virulent anti-catholicism; he was widely credited with counteracting the catholic sympathies of a number of the chief secretaries and viceroys under whom he served. He worked tirelessly to control anti-government newspapers, and assisted Peel's plans for police reform. His friendship with the chief secretary continued after Peel returned to England in 1818, and they worked closely together in the 1820s when Peel was home secretary.
Believing catholic emancipation to be the first step in the disintegration of the empire, Gregory was uncompromising in his opposition to reform. Nevertheless he had an ambivalent attitude towards the Orange Order, despite the insistence of Daniel O'Connell (qv) to the contrary. Because of his strident opposition to emancipation the new viceroy, Marquis of Wellesley (qv), asked him to resign in 1821, but he refused. He tendered his resignation in 1827 when George Canning, a supporter of emancipation, became prime minister, but was persuaded to remain in office. Lord Anglesey (qv), the incoming viceroy, also wanted to be rid of Gregory, blaming him for frustrating previous liberal occupants in the Castle, but once again he managed to hold on.
The crisis resulting from O'Connell's election in 1828 did not change his opinions. He believed that the government should hold firm and was furious with Peel in 1829 for allowing emancipation to be carried; their friendship cooled and never fully recovered. He was dismissed from office at the end of 1830 as a condition of Anglesey leaving Ireland. In any case O'Connell demanded his removal, referring to him with typical hyperbole as the real ruler of Ireland, and he was forced to leave office on 27 December 1830. He retired from public life and died 13 April 1840 at his Phoenix Park residence. A collection of his papers in held at Emory University, Atlanta, Georgia.
He married (1 Oct. 1789) Anne, daughter of William Power Keating Trench, 1st earl of Clancarty. They had two sons and one daughter. The elder son, Robert, was the father of Sir William Henry Gregory (qv), who married Augusta, Lady Gregory (qv).