The man who tried to assassinate former US president Ronald Reagan is set to be freed from a psychiatric hospital and allowed to live in the community.

It comes after a federal judge ruled John Hinckley Jr was no longer a danger to himself or others - 35 years after he was detained over the shooting.

Hinckley, 61, will be allowed to live full-time with his mother at her home in Williamsburg, Virginia after Judge Paul L Friedman's decision.

There are dozens of conditions attached to the order and he will not be able to reside there until 5 August at the earliest.

Hinckley will have to meet his psychiatrist in Washington at least once a month and let the Secret Service know when he travels for the appointments.If Hinckley relapses or violates the terms of his release, he could be returned to the government psychiatric hospital, St Elizabeth's, in Washington, the judge ordered.

He was found not guilty by reason of insanity in 1982 for the attack which wounded Mr Reagan in the chest.

Three other people were also hurt, including presidential press secretary James Brady.

Over a number of years, doctors have said Hinckley is no longer plagued by the mental illness that drove him to shoot the president on 30 March 1981.

He said he carried out the attack outside a hotel in the US capital in an attempt to impress Hollywood actress Jodie Foster, whom he had an obsession with.

For more than a year he has been allowed to spend 17 days a month at his mother's home.

And since 2006, Hinckley has completed more than 80 unsupervised visits to Williamsburg, the judge said.