After returning to Serie A in the 2007–08 season, Juventus appointed Claudio Ranieri as manager. They finished in third place in their first season back in the top flight and qualified for the Champions League third qualifying round in the preliminary stages. Juventus reached the group stages, where they beat Real Madrid in both home and away legs, before losing in the knockout round to Chelsea. Ranieri was sacked following a string of unsuccessful results, with Ciro Ferrara being appointed as manager on a temporary basis for the last two games of the 2008–09 season. Ferrara was subsequently appointed as the manager for the 2009–10 season.