Sir Keir Starmer has accused the prime minister of breaking the law.