In the 1980s, Walsh was one of the "Gang of 22" who opposed Charles Haughey's leadership of Fianna Fáil. In spite of this, he was appointed Minister of State at the Department of Agriculture and Food when Haughey returned as Taoiseach after the 1987 general election. In 1989, he was a key figure in the negotiations which led to the formation of the historic Fianna Fáil-Progressive Democrats coalition government. He remained as Minister of State until 1992 when Albert Reynolds became Taoiseach. Walsh was appointed to the Cabinet as Minister for Agriculture and Food in February of the same year. He remained in that position until December 1994. In 1997 Fianna Fáil returned to power and Walsh was again appointed Minister for Agriculture and Food in Bertie Ahern's government.