BERLIN — A man who disarmed four police officers and then spent five days hiding in Germany's Black Forest last year was convicted of hostage-taking and other offenses Friday and sentenced to three years in prison.

The defendant, 32-year-old Yves Rausch, said during his trial at the state court in Offenburg that he had disarmed the officers in an unplanned move because he was afraid of being arrested and sent to prison again. But he said he never intended to hurt anyone with the weapons, news agency dpa reported.

The incident last July triggered a manhunt that involved more than 2,530 officers around the small town of Oppenau in southwestern Germany.

The drama started when police were alerted to a suspicious person carrying a bow and arrow. Officers conducted an ID check on the suspect at a hut where he had settled illegally. Officials have said Rausch initially cooperated but suddenly pulled a gun, threatening the officers and forcing them to hand over their service weapons. Nobody was hurt.

The four missing police weapons were recovered and an additional handgun found when the suspect was arrested. He also was carrying a hatchet.

The fugitive had had run-ins with police before. He was given a 3 1/2-year juvenile sentence in 2010 after shooting with a crossbow at a woman and wounding her, according to prosecutors in nearby Pforzheim. Rausch said he had been living in the forest for some time and wanted to prepare for a walk across Germany.