Tens of thousands of people have marched to Spain's parliament to protest against the government's new law that aims to restrict abortion, allowing the practice only in cases of rape or serious risk to health.

Saturday's rally in Madrid was organised by dozens of women's groups and bodies that fight for reproductive rights.

Protesters carried banners saying "Allow mothers to decide" and "Mothers and fathers in freedom".

The previous Socialist government made abortion before the 14th week widely legal. But the ruling Popular party has long sided with the Roman Catholic Church on moral and social issues and made changing the law one of its main promises in the 2011 vote that brought it to power.

In December, justice minister Alberto Ruiz-Gallardón said that abortion will only be allowed in the case of rape or when there is a serious mental or physical health risk to the mother. Accredited fetal deformities that would endanger a child's life if born will also be accepted.

He also said 16- and 17-year-olds will once again have to obtain permission from their parents to have an abortion.

The bill, which must be approved by parliament, been fiercely resisted by opposition parties as well as women's groups across Spain who said that it set back women's rights to the dark days of the dictatorship of Francisco Franco.