After Parliament was dissolved in June 1802, another election saw Coke again returned, although in a contested election that cost the candidates £35,000. With the death of William Pitt in 1806, the two Whig groups agreed to an alliance, which took the form of the Ministry of All the Talents; Fox was confirmed as Foreign Secretary, and Windham as Secretary for War and the Colonies. The government apparently offered Coke a peerage, which he refused, and primarily focused on the abolition of slavery, which was accomplished only after the death of Fox on 13 September 1806. Fox's death made Parliament lose some of its appeal to Coke, as they had been close friends. His attendance in the next two years was very limited, and the next occasion of note was his support of the Corn Laws, which were highly unpopular in Norfolk and led to him being physically attacked by a mob in 1815.