Parents in Germany could face thousands of dollars in fines if they fail to vaccinate their children for the measles under a law passed Thursday.

The law, which takes effect in March 2020, mandates that parents provide proof of immunizations for all children aged 6 and older, as well as children seeking to attend preschool. Parents could face up to $2,750 in fines if they don't comply, The New York Times reported.

WOMAN'S HALLOWEEN COSTUME POKING FUN AT MEASLES SPARKS OUTRAGE FROM PRO-VAXXERS

The law comes as Germany has recorded more than 500 cases of measles this year, part of an upsurge of the disease that had once been largely eradicated in most developed parts of the world. An anti-vaccine moment has fueled various measle outbreaks, prompting some municipalities to take action.

In an address to parliament, Jens Spahn, Germany’s health minister, called measles an "unnecessary risk" while rejecting criticism from antivaccine advocates that requiring immunizations infringes on their individual rights.

“My understanding of freedom does not stop at my level as an individual,” Spahn said, according to Times. “It is also a question of whether I am unnecessarily putting others at risk.”

“Freedom also means that I will not be unnecessarily put at risk and that is precisely why, from the point of view of preserving freedom, this law is a good law, because it protects freedom and health,” he added.

CLICK HERE FOR THE FOX NEWS APP

The law also requires immunizations for adults born after 1970 who work with children in daycare centers schools, hospitals or other public institutions. Exemptions will be allowed for medical reasons if approved by a doctor.

Older children in school must be vaccinated before July 31, 2021. Schools and other institutions will be required to report parents who fail to immunize their children to local health authorities.