David Beckham "felt helpless" when a stalker tried to collect one of his children from school, a court was told.
Westminster Magistrates' Court heard Sharon Bell, from Watford, had been charged with stalking but was not facing a criminal trial because she had a mental health disorder.
The court heard she also went to his homes and wrote "threatening" letters.
A judge ruled Bell had carried out the criminal conduct and detained her under the Mental Health Act.
District Judge Michael Snow also imposed a civil stalking protection order banning Bell, of Boundary Way, from contacting the Beckhams or their four children for the rest of their lives.
"This is one of those rare cases where an indefinite order is necessary to protect those members of the Beckham family named within it from serious psychological or physical harm from Ms Bell," he said.
'Helpless and angry'
The court heard the ex-England captain, 47, was targeted by the 58-year-old woman between July and November last year.
It heard she sent "threatening" letters before attending the Oxfordshire and west London homes of the footballer and his wife, former Spice Girls singer, Victoria Beckham, 48.
Then on 18 November, Bell was said to have turned up at the school of one of their children, claiming she was there to pick them up.
"I felt helpless and angry that there was nothing I could do. I was very concerned for [my child's] safety," said Mr Beckham, in a statement read out in court.
Mrs Beckham said in her statement she went to pick the child up with a security guard, while Bell was described by police as "looking vacant" before she was arrested.
The court heard Bell was fixated with Mr Beckham.
In one letter she accused his wife of owing her money and another said actor Tom Cruise, who is friends with the Beckhams, had "really upset me".
The judge said he was satisfied Bell had carried out the criminal conduct and referred to the "rather frightening thought" of her researching the Beckhams' addresses, and the "chilling words" used in her letters.