The highest court in Massachusetts on Thursday set legal guidelines for when and how parents can use spanking to discipline their children, the Associated Press reports. This is the first time legal guidelines for corporal punishment have ever been established.

The Massachusetts Supreme Judicial Court said a parent or guardian may not be subjected to criminal liability for the use of force against a minor child under the care and supervision of the parent or guardian, provided that the force used against the minor child is reasonable, according to Universal Hub, a community and news information site for the Boston area.

The court specified that the force must be reasonably related to “the purpose of safeguarding or promoting the welfare of the minor, including the prevention or punishment of the minor's misconduct.” Further, said force, if applied appropriately, “neither causes, nor creates a substantial risk of causing, physical harm (beyond fleeting pain or minor, transient marks), gross degradation, or severe mental distress.”

By requiring the force to be reasonable and reasonably related to a legitimate purpose, the decision balances respect for parental decisions with the Commonwealth’s compelling interest in protecting children against child abuse, the court said. The decision made reversed an assault and battery conviction of a Brockton, Massachusetts man who was arrested after spanking his three-year-old daughter in view of two police detectives, Universal Hub reported.

“We recognize that the balance we strike with the parental privilege defense may well be imperfect and that absolute equipoise between the goals of protecting the welfare of children and safeguarding the legitimate exercise of parental autonomy is likely unattainable,” the Massachusetts Supreme Judicial Court said. “To the extent that that is so, the balance will tip in favor of the protection of children from abuse inflicted in the guise of discipline.”