German prosecutors have charged three men and one woman with forming a far-right terror group and planning an attack.

Federal prosecutors say the four are accused of establishing a "terrorist organisation" that went by the name Oldschool Society.

Prosecutors said the group planned to use explosives to attack a refugee shelter last May. They were arrested on May 6 before the attack could take place.

Internally, the group became increasingly radical and, in mid-November 2014, members discussed how to manufacture explosives and the possibility of attacking Islamic extremists and asylum-seekers in Germany.

The four are identified as Andreas H, 57; Markus W ,40; Denise Vanessa G 23; and Olaf O, 47, in line with German privacy rules. Andreas H and Markus W were described as the group's president and vice president.

"There was a concrete plan to carry out an explosives attack on an inhabited refugee shelter near Borna in connection with their second meeting from May 8-10 2015," prosecutors said. The town is south-east of Leipzig in the eastern state of Saxony, which has been a hotbed of anti-foreigner sentiment over the past year.

Markus W and Denise Vanessa G allegedly travelled to the Czech Republic in May 2015 to purchase fireworks and the group discussed how to make them more dangerous by wrapping nails around them.

All four are in prison pending trial.

Separately, Hannover prosecutors said they charged two men, aged 25 and 31, and a 24-year-old woman with attempted murder and attempted arson on allegations they threw a gas bomb through a window at an asylum-seekers' home in north-western Germany.

The three are alleged in August to have thrown the improvised device through a ground-floor window in a school building in Salzhemmendorf that had been converted to house about 30 asylum seekers, setting fire to a mattress and a rug in an unoccupied room. The trio fled in a car from the scene, prosecutors said.

The early-morning blaze was quickly extinguished and authorities said no harm came to a woman who had been sleeping in a neighbouring room with her three young children.

Prosecutors said the three have admitted to the attack, but not to their motivation.

German authorities have recorded a rise in attacks against refugees over the past year amid an unprecedented influx of asylum seekers to the country. While most of the attacks are believed to have been carried out by people with no previous affiliation to far-right groups, authorities are sensitive to the possibility that neo-Nazi groups might stage violent attacks ever since the existence of the self-styled National Socialist Underground (NSU) came to light four years ago.

The NSU allegedly killed eight Turks, a Greek and a policewoman between 2000 and 2007, and is believed to be behind two bombings and 15 bank robberies.

The group's sole survivor, Beate Zschaepe, and four alleged supporters are currently on trial in Munich.

PA Media