WASHINGTON — The man who attempted to assassinate President Ronald Reagan will get to spend more time outside a mental hospital where he has been confined for most of the past three decades, a judge ruled Friday.

John Hinckley will be allowed to visit his mother's home in Williamsburg, Va., for up to 17 days at a time. Hinckley has been allowed to spend increasing amounts of time at his mother's house in recent years, but previous visits were capped at 10 days. Hinckley must make at least eight successful 17-day visits away from the hospital before any requests to increase his time in Williamsburg will even be considered, said U.S. District Judge Paul L. Friedman.

In court hearings before the ruling, Hinckley's lawyer, Barry Levine, had asked for his visits to be expanded to 17 and 24 days, arguing that there is no evidence Hinckley is a danger to himself or others. Attorneys for the U.S. government, however, argued that Hinckley is "capable of great violence" and told the judge that granting expanded privileges was "premature and ill conceived."

Friedman wrote that Hinckley's depression and psychotic disorder are in full remission and that he had not displayed violent behavior in more than 29 years.

"Based on the evidence presented at the hearing, the court is confident that under appropriate conditions, Mr. Hinckley will not likely be a danger to himself or others if his visits to Williamsburg are expanded from ten days to seventeen days," Friedman wrote. "Mr. Hinckley has been making 10-day visits to Williamsburg for nearly four years, without in any way decompensating or doing anything that might suggest a risk of danger." Friedman wrote.

Still, the judge said Hinckley continues to be "guarded, defensive and sometimes secretive" and is occasionally deceptive, such as when he visited a Barnes & Noble bookstore — instead of a movie theater, as had been scheduled — and then lied about it during 2011 visits to Williamsburg.

Levine did not immediately return a call seeking comment.

Friedman's ruling is two years in the making and comes after a series of hearings on the issue. In late 2011 and early 2012, attorneys for Hinckley and the government spent a total of two weeks discussing whether Hinckley should be allowed to spend more time away from St. Elizabeths Hospital, the mental health facility in Washington where he has lived for decades.

There were additional follow-up hearings early this year. Those hearings were called because a treatment facility near Hinckley's mother's home, where he was going to attend group programs while there, withdrew its participation.

Throughout the hearings, both sides have attempted to paint strikingly different pictures of Hinckley. His brother and sister testified, describing him as a person who likes taking long walks and has an interest in music, particularly Bob Dylan and the Beatles. And doctors said the mental illness that led a jury to find him insane at the time he shot Reagan in 1981 has been in remission for years.

At the same time, Secret Service agents trailing Hinckley during his visits to his mother's home testified they caught him browsing in a bookstore when he had said he would be attending a movie and looked at shelves that contained books about Reagan. Friedman said there was no evidence that Hinckley had ever touched, picked up or read any books on presidential assassinations, and that the agents' testimony "do not show anything other than a possible but unconfirmed expression of brief interest in the covers of such books by Mr. Hinckley."