Hansen cost Liverpool £110,000. He made his debut on 24 September 1977 in a league match at Anfield. Derby County were the visitors and were beaten by a single goal scored by Terry McDermott. Hansen hit his first goal the following month on 19 October during a European Cup 2nd round 1st leg tie at Anfield. He opened the scoring in the 14th minute as Liverpool demolished East German side Dynamo Dresden 5–1.
The following season, 1978-79, Hansen was a regular in the team as Liverpool regained the league title. The team's final points tally of 68 was a record under the two points for a win system, and they conceded only four goals at home at Anfield. When long-serving club captain Emlyn Hughes was sold to Wolves, Hansen became an automatic first choice central defender in the team, and Liverpool's domination of English club football continued in the 1979–80 season with another league title.
Hansen's second Scotland cap came the following month on 2 June 1979 in a prestigious Saturday afternoon friendly match at Glasgow's Hampden Park against reigning World Champions Argentina. On the hottest day in Glasgow for 30 years, the 61,000 sun-drenched crowd at Hampden Park saw the South Americans beat Scotland 3–1, with an 18-year-old Diego Maradona scoring his first international goal for Argentina in a virtuoso display of skill and trickery. In an interview in 2007, Hansen said that Maradona was "without a Shadow of a doubt the best player I came up against. He was virtually unplayable – even at 18."
Hansen lives in Southport with his wife Janet. They have been married since 1980 and have a son Adam and a daughter Lucy.
The league title returned to Anfield in the 1981–82 season, and Liverpool also retained the League Cup in 1982 with a 3–1 win over Tottenham Hotspur, although Hansen missed this victory with injury. Liverpool did not retain the European Cup in 1982, surprisingly losing in the quarter-final to CSKA Sofia 2–1 on aggregate.
Hansen played for Scotland in the 1982 World Cup in Spain. The team failed to progress beyond the qualifying group, having drawn 2–2 with the USSR when Scotland needed a win to progress in the tournament. An accidental collision between Hansen and central defensive partner Willie Miller allowed USSR striker Ramaz Shengelia through to score the Soviets' second goal.
In the 1983–84 season, Liverpool completed a treble of trophies in Fagan's first season as manager, winning the league title, League Cup and European Cup. Hansen was involved in a controversial incident in the League Cup final at Wembley when he appeared to handle a shot on the goal line. Despite protests from opponents and Merseyside rivals Everton, no penalty was given. Liverpool won the final after a replay at Maine Road.
Liverpool did not win a trophy in the 1984–85 season and were banned from all European competition after the 1985 European Cup Final which pitted Liverpool against the Italian giants Juventus at Heysel was preceded by rioting which caused the deaths of 39 people, including 32 Italian Juventus fans. Liverpool lost the match 1–0. Hansen would never play in a European tie again.
A formidable Scotland central defensive partnership was formed between Willie Miller and Alex McLeish of Aberdeen, who were managed by Alex Ferguson. Ferguson, who took charge of the national team after the sudden death of Jock Stein, dropped Hansen from the squad for the 1986 World Cup in Mexico. Hansen disagreed with the decision, as he felt that his form in the 1985/86 season (when Liverpool had won a league and cup double) was near his best. Hansen had played infrequently for Scotland before the tournament, and had often withdrawn from squads. Hansen won the last of his 26 Scotland caps in 1987.
Hansen was restricted to just six league appearances in the 1988–89 season as a result of a dislocated left knee sustained in a pre-season friendly against Atlético Madrid in Spain. Hansen played in the 1989 FA Cup final at Wembley, which Liverpool won 3–2 in extra-time against Everton, though Hansen did not lift the trophy as captain. The honour was given to teammate Ronnie Whelan who had deputised in Hansen's absence through injury and retained the role even after the club's first choice captain was fit again. Hansen did not have any objections to Whelan keeping the captaincy that season.
On 15 April 1989, the Hillsborough disaster claimed the lives of 96 Liverpool fans. Hansen was selected for the FA Cup semi-final match against Nottingham Forest at Hillsborough, playing the opening six minutes of the match before the game was called off. Hansen attended 12 funerals and visited the injured in hospital.
Hansen was unable to play in any competitive games during the 1990–91 season (when Liverpool finished second in the league and were trophyless for only the third time since Hansen's arrival 14 years earlier) and he retired in March 1991, a month after Kenny Dalglish resigned as manager. At this stage Ronnie Moran was caretaker manager until the appointment of Graeme Souness in the permanent position shortly afterwards.
After rejecting the idea of management, when he retired from football in 1991 he planned to take three months off. After his wife pointed out that nobody had contacted them during his rest period, he started calling the networks. Sky Television employed Hansen as a pundit and summariser almost as soon as he ceased playing, and soon he had established enough of a reputation as a considered observer and thinker within the game for the BBC to approach him. He began working for BBC Radio 5 Live, before moving on to Match of the Day. Hansen was employed for 22 years as the main pundit for the BBC's football coverage (rights to show matches or highlights permitting) and was known as a calm, authoritative, and rational analyst of the game who is particularly keen on highlighting the triumphs and "shocking", "poor" or "diabolical" mistakes of defenders and commenting on "mediocre" performances. He is a columnist for the Daily Telegraph, Telegraph.co.uk and the BBC website on football issues and has also worked as a motivational speaker.
Hansen was offered the Huddersfield Town job in 1992 following the sacking of Eoin Hand but he turned it down. There were strong rumours that Hansen would be approached to take over as manager of Liverpool after his former captain Graeme Souness was sacked by the club in 1994. However, he ruled himself out of the running, stating that despite his great affection for the club, he simply was not interested in coaching or management; a position he has maintained ever since Roy Evans got the job. In 1995, following the sacking of Brian Horton, Hansen turned down an offer to manage Manchester City.
In his autobiography, Hansen described the tragedy as "the blackest period of my life". He wrote: "The number of broken hearts was incalculable. The immediate aftermath, when Kenny Dalglish and the players attended the funerals and tried to show support for the grieving families took more out of me emotionally than any other experience I have gone through." On Match of the Day in April 2009, Hansen spoke emotionally about the tragedy. He said: "It was a horrific time, traumatic for everybody. It must never be forgotten." In 2010, Hansen said that each of the funerals that he attended after Hillsborough got harder. "The emotional scars will be there forever," he said.
During an appearance on Match of the Day on 21 December 2011, while discussing the prominence of racism in English football following allegations against Premier League players Luis Suárez and John Terry, Hansen caused controversy after twice using the word "coloured" in reference to black footballers. The BBC received 82 complaints by the following morning while some, including Shamrock Rovers player Rohan Ricketts, criticised Hansen's choice of words on social network Twitter. Ricketts tweeted: "He is part of the Problem when using that word. We are BLACK Alan!". Others defended his use of words. Daily Telegraph Blogger and commentator Toby Young wrote: "In his defence, Hansen could cite the fact that America's foremost civil rights group is the NAACP which stands for the National Association for the Advancement of Colored People. If it's acceptable for the NAACP to use the word "coloured", why isn't it acceptable for him?" Hansen issued an apology the following day, saying "'I unreservedly apologise for any offence caused – this was never my intention and I deeply regret the use of the word."
In an article in the Daily Telegraph, Hansen responded to the Hillsborough Independent Panel report of September 2012, by writing: "I have encountered ignorance about Hillsborough on many occasions, finding myself having to correct the inaccurate version of events. The report explicitly removes the excuse of ignorance for those who misunderstood the tragedy. Each sentence in it reads as a tribute to the honesty, integrity and dignity of the families and is an acknowledgement of everything they have been saying since those first, scurrilous accusations surfaced."
In May 2013, it was reported that Hansen's BBC contract was due to expire after the 2014 FIFA World Cup. On 5 September 2013, Hansen announced he would retire as a Match of the Day pundit following the 2014 World Cup. His last appearance on Match of the Day during the 2013–14 season came on 11 May 2014.
Hansen turned down the opportunity to study at the University of Aberdeen, in order to join his older brother John at Partick Thistle. During the summer while his application was being processed, he worked for six weeks in the offices of General Accident insurance — which he hated. As a trainee, Hansen attended the 1971 Scottish League Cup Final, seeing a Partick Thistle side that included his brother John create one of the biggest shocks ever in Scottish football by defeating favourites Celtic 4–1 at Hampden Park.