Upon Labour's return to power after the 1974 election, Wilson appointed Castle Secretary of State for Health and Social Services, during which time she was responsible for the creation of Carer's Allowance and the passage of the Child Benefit Act. She was also a prominent opponent of Britain's continued membership of the European Economic Community during the 1975 referendum. When Castle's bitter political rival, James Callaghan, replaced Wilson as Prime Minister in 1976, he sacked her immediately from the Cabinet; the two would remain bitter towards each other for the rest of their lives. Opting to retire from Parliament at the 1979 election, Castle quickly sought election to the European Parliament, representing Greater Manchester from 1979 to 1989; during this time, she was the Leader of the European Parliamentary Labour Party from 1979 to 1985, and publicly reversed her previous stance of Euroscepticism. She became a member of the House of Lords, having been granted a life peerage, in 1990, and remained active in politics until her death in 2002 at the age of 91.