(NBC News) - John Hinckley Jr., the would-be assassin who nearly killed President Ronald Reagan, will be freed after 35 years in a mental hospital, a federal judge ruled Wednesday.

The judge granted Hinckley, 61, permission to live full-time in the home of his mother in Williamsburg, Virginia, after finding that his continued treatment at St. Elizabeth's Hospital in Washington, D.C., is "no longer clinically warranted or beneficial."

Hinckley must live with his mother for at least the first full year of his release, wrote U.S. District Judge Paul Friedman. He may then be allowed to live in a separate home either alone or with roommates — provided that members of his treatment team approve.

Friedman said he is confident Hinckley's family has enough money to continue treatment and care while he is out of the hospital, and noted that he will be able to apply for government benefits once he becomes a resident of Virginia.

But if he relapses, he would have to return to the mental hospital.

Hinckley in 1981 was 25 when he opened fire outside of the Washington Hilton, hitting Reagan in the chest. Press Secretary James Brady was also shot in the head, while a police officer and a Secret Service agent were wounded.

Hinckley, who said he wanted to impress actress Jodie Foster, was found not guilty by reason of insanity and ordered to live at St. Elizabeth's for treatment. Over the years, the court has loosened restrictions on him, and more recently has already been allowed to spend consecutive days at his mother's residence in a gated community south of D.C.

According to The Associated Press, he has gone shopping and to the movies, although Secret Service occasionally watches him.

Prosecutors, however, have argued against increased freedoms for Hinckley, saying he has a history of being deceptive and once wrote in a 1987 journal entry that psychiatrists would "never know the true John Hinckley."