A federal judge ruled Monday that John Hinckley Jr. can be unrestrictedly released next year, more than 40 years after he shot then-President Reagan in 1981.

Hinckley was committed to St. Elizabeth's hospital for more than 34 years before he was released under certain restrictions in 2016.

"If he hadn’t tried to kill a president he would have been released unconditionally a long time ago," U.S. District Court Judge Paul Friedman said.

FOX NATION DIGS INTO 'THE CURSE OF TIPPECANOE' AS PART OF LOOK BACK AT REAGAN ASSASSINATION ATTEMPT

It was Friedman who had allowed Hinckley out five years ago, determining that Hinckley's mental condition was "in full and sustained remission" and had been for more than 27 years. He had been diagnosed with a psychotic disorder and major depression.

Upon his restricted release from St. Elizabeth's in 2016, Hinckley was required to live with his mother in Williamsburg, Virginia. He also was forbidden from having a firearm, contacting Reagan's children, or contacting actress Jodie Foster. Hinckley had been obsessed with Foster, and had written in a letter that he intended to assassinate Reagan to impress her.

The government has also been monitoring his care. 

CLICK HERE TO GET THE FOX NEWS APP

Hinckley will be released unrestrictedly in June 2022. His attorney Barry Levine celebrated his client's release, saying it was a "great day for mental health."

Fox News' Jake Gibson contributed to this report.