For how many years was Mary, the queen of Scots, kept in prison?

Mary, Queen of Scots, had a pretty dramatic life. She was Catholic, and her claim to the English throne posed a major threat to Queen Elizabeth I, who was Protestant. After being forced to abdicate the Scottish throne in 1567, Mary fled to England hoping for Elizabeth's help. However, Elizabeth saw her as a dangerous rival. Instead of offering sanctuary, Elizabeth had Mary imprisoned in 1568. For the next two decades, Mary was moved between various castles and manor houses in England, always under guard. She was a constant source of plots and conspiracies against Elizabeth. Eventually, after being implicated in the Babington Plot to assassinate Elizabeth, Mary was tried and executed in 1587. So, while she sought refuge, she ended up spending a significant chunk of her life – 20 years to be exact – as a prisoner in England. It's easy to think of shorter periods, but it was a long two decades of confinement.
Picture two decades spent by Mary 'locked inside' the shadow of the Scottish throne.