We have owed the money since 1979 - 43 years.
The Shah ordered 1,500 tanks and paid £400m upfront and was then overthrown and the Iranian Republic was formed.
Sanctions were imposed by the UN, EU and other individual nations when Iran’s nuclear programme became public, think that was 1999/2000 or so.
Iran agreed to a deal in 2013 which saw it gain some relief from sanctions in return for curbing its nuclear programme and giving UN inspectors better access to its facilities. Couple of years later a number of dual nationals were detained on vacuous charges.
IIRC there was a change in the Iranian position in 2021 when Iran admitted why they were holding them.
We were also in a position, built over time, to pay the bill in a way that bypasses the sanctions.
Sometimes it is a chain of events that can`t be changed or blamed on someone.
She is lucky she had dual nationality and the UK Government has found a way to get her released.