Russia has released former US Marine Robert Gilman after more than four years in prison over an alleged assault on a police officer.