The London Bridge attacker Usman Khan had been released from prison after serving half of a 16-year sentence. Prime Minister Boris Johnson said this was "because of changes to the law that were brought in by the Labour Party that I voted against". So did he?

Khan served a sentence for a plot to set up a terrorist training camp. He was then released automatically after eight years with no review by the Parole Board.

Mr Johnson tweeted that this was because of Labour's Criminal Justice and Immigration Act 2008.

In another tweet he said: "Although four senior judges considered that Khan was dangerous, he was to be automatically released halfway through because of Labour's 2008 law."

Khan was originally given an indeterminate sentence in 2012, meaning one with no fixed end date. But during an appeal the next year, this was downgraded by judges to an "extended sentence" of 16 years in prison with automatic release on licence after eight. He was released in December 2018 after the time he'd spent on remand was taken into account.

The prime minister told the BBC's Andrew Marr show: "His release was necessary under the law because of the automatic early release scheme under which he was sentenced and that was brought in by Labour with the support of Jeremy Corbyn and the rest of the Labour Party. I opposed it both in 2003 and in 2008."

Mr Johnson did vote against the Criminal Justice Act 2003. That law meant most offenders would be automatically released halfway through their sentences, but "dangerous" offenders on extended sentences were only to be released with the Parole Board's consent.

It was the 2008 law that changed these extended sentences so there would be automatic early release with no Parole Board review.

A Conservative Party spokesperson said Mr Johnson had "voted against this Bill on two key votes on the Bill's passage through Parliament along with almost all Conservative MPs and the Conservative front bench raised specific concerns about automatic release during debates on it".

What's the evidence?

We looked through Hansard - the record of what goes on in Parliament - to find out what happened.

The law was first proposed in 2007 - when Labour was in government and the Conservatives in opposition. Mr Johnson did vote against both the "programme motion"- which sets the timetable for passing the bill - and the motion to carry the bill over into the next Parliamentary session. But at that stage it did not contain the measure that affected Khan's later case.

The key clause relating to automatic release on licence for prisoners on extended sentences was added during the report stage - a chance for MPs to review and change the law - in January 2008.

MPs voted on this measure as part of a group of amendments on 9 January 2008. The Conservatives voted against but Hansard has no record of Boris Johnson being present for that vote.

The bill then had its third reading the same day and was passed without a division - a formal vote. The Conservative opposition could have forced a division but did not.

The then Labour Justice Secretary Jack Straw said he did not recall Mr Johnson expressing any opposition at the time. Edward Garnier, the shadow prisons minister at the time, could not recall whether Mr Johnson opposed the bill, while Nick Herbert, then shadow justice secretary, declined to comment.

Several then Conservative MPs including Mr Herbert, as well as then Labour backbenchers Jeremy Corbyn and John McDonnell, criticised the lack of time to debate the bill.

The Times, on the day after the bill was passed, carried just a couple of paragraphs - the focus was almost entirely on a part of bill that stopped prison officers from striking.

What claims do you want BBC Reality Check to investigate? Get in touch

Read more from Reality Check

Follow us on Twitter