A train has derailed near a Bavarian Alpine resort in southern Germany killing at least four people and injuring dozens.

Several carriages of the red-coloured local train were lying on their sides on a grassy area next to a highway.

Rescuers stood on the top-facing side of the carriages, using ladders to climb into the waggons to reach trapped passengers.

"In the serious train accident, as of 3.32pm, four people were fatally injured," police said in a statement.

"Around 30 passengers were injured, 15 of them so seriously that they have had to be admitted to nearby hospitals," they said, adding that a huge rescue operation was under way.

The accident came as rail officials were nervously watching if a new €9 monthly public transport ticket valid across Germany would lead to overcrowded trains over the bank holiday weekend.

Stefan Sonntag of Upper Bavaria's police force said the regional train was "very crowded and many people were using it, hence the high number of injured".

School holidays were also starting from tomorrow in the two southern German regions Baden-Wuerttemberg and Bavaria, raising fears children may count among the train passengers. But Sonntag said he did not have information on that.

The train had just left Garmisch-Partenkirchen for Munich, when the accident took place in the Burgrain district of the resort town, just past midday.

Part of the route between Munich and Garmisch-Partenkirchen has been blocked off and traffic diverted, said German rail operator Deutsche Bahn, which was not yet able to provide a reason for the accident.

Rescue teams remove a casualty from the scene of the crash

Rescue operation

Popular mountain resort Garmisch-Partenkirchen and the surrounding regions have begun preparations to host the G7 summit of world leaders later this month.

From 26-28 June, the heads of state and government including US President Joe Biden are due to meet at Schloss Elmau - 11km from Garmisch-Partenkirchen.

Police and soldiers who had been deployed to prepare and secure the site ahead of the summit have now also been enlisted to help in the rescue operation.

Rescue services at the site of a derailed train near Burgrain, southern Germany

Three helicopters from Austria's Tyrol region have been scrambled to the scene to provide first aid, according to media reports.

Germany's deadliest rail accident happened in 1998 when a high-speed train operated by state-owned Deutsche Bahn derailed in Eschede in Lower Saxony, killing 101 people.

The most recent fatal crash took place on 14 February, 2022, when one person was killed and 14 others hurt in a collision between two local trains near Munich.

In 2017, a passenger train and a stationary freight train collided near the western city of Duesseldorf injuring 41 people.