Three men and a woman were sentenced to prison terms between three and five years Wednesday for forming a far-right terrorist group in Germany with a plan to bomb refugee homes.

The Munich state court ruled that the four founded the so-called Oldschool Society in August 2014. The group grew to have about 30 members with plans to commit attacks on foreigners and refugee homes because of their racist, anti-Semitic and anti-Muslim beliefs, the court said.

The group had planned to attack a refugee shelter in the Saxon town of Borna in May 2015, but police had the group under surveillance and detained the four founding members shortly before they could carry out the plan.

The head of the group, 58-year-old Andreas H., from the southern city of Augsburg, was sentenced to four and a half years in prison.

Deputy leader Markus W., 41, received five years and his girlfriend, Denise G., 24, received three years and 10 months. Both are from the eastern state of Saxony.

Olaf G. from the western city of Bochum, the group's spokesman, was sentenced to three years. Last names were withheld in line with German privacy rules.

Police found weapons and illegal explosives during raids on their homes. According to the court, Markus W. and Denise G. had bought the illegal explosives in the Czech Republic just days before the planned attack in Borna.

Germany has seen a sharp increase in attacks on asylum homes in the last two years amid an unprecedented influx of migrants seeking refuge in Germany from war, persecution and poverty.