A breast-feeding mother is embroiled in a court battle in Maryland after an official said she must let her estranged partner give the 6-month-old boy formula while the child is visiting him.

Amber Brown, 27, of Upper Marlboro, gave birth in February to the boy. Brown and the boy’s father, Corey Donta Lewis, separated shortly after their child’s birth.

At a July custody hearing, Monise A. Brown, a family magistrate in Charles County, addressed a disagreement between the couple: Amber Brown wanted to exclusively breast-feed her child, but Lewis insisted the child be able to consume formula to facilitate overnight visits with him, according to court documents.

After Amber Brown explained she couldn’t pump enough milk for an overnight visit, the magistrate sided with the child’s father.

“The magistrate stated pointedly that breast-feeding is not a reason to prevent [Lewis’s] visitation, and that insisting on breast-feeding would be considered deliberate alienation of [Lewis],” according to an affidavit from Jay R. Halleck, an attorney who represented Amber Brown at the hearing.

At a follow-up hearing, Magistrate Mistey L. Metzgar appeared to agree with her fellow family magistrate, recommending overnight visits begin Aug. 4, according to court filings. But Amber Brown filed a request for an exception on Aug. 10, saying the child’s pediatrician said the boy couldn’t tolerate formula — and that, during one visit, Lewis had fed him formula anyway.

“It was simply more convenient for [Lewis] to feed the baby formula than to ensure the baby remained healthy,” the request for exception reads.

Amber Brown’s request for the exception alleged a “clear and improper policy” in Charles County courts “creating a presumption that breast-feeding is used to alienate fathers and that babies should be switched from breast milk to formula in order to accommodate overnight visitation.”

Lewis declined to comment, citing the need to contact legal counsel. The magistrates in the case didn’t return a request for comment on Wednesday.

In a telephone interview, Amber Brown said she tried home remedies in an attempt to produce more breast milk, including lactation cookies and herbal tea, but was unable to pump enough for an overnight visit.

Citing the American Academy of Pediatrics and other heath officials, a Maryland Senate bill that became law in 2003 indicated “the state is interested in the promotion of family values and to that end encourages public acceptance of this basic act of nurture.”

Jeanette Rice, Amber Brown’s attorney, said she was outraged by the magistrates’ recommendations. “I’ve been practicing for 20-plus years,” she said. “I’ve never had a magistrate tell someone not to breast-feed.”

Custody disputes related to breast-feeding are not unheard of. A mother in Pennsylvania said a judge in 2013 ordered her to stop breast-feeding to accommodate visits with the father of her child. Bristol Palin, daughter of former Alaska governor Sarah Palin, said in court last year her former fiance’s custody demands would disrupt her breast-feeding schedule.

George Washington University law professor Catherine J. Ross said courts are generally tasked with defending the best interests of children, for whom breast-feeding is often considered healthiest.

“Even as the legislatures and courts have tried to put parents of both genders on an equal footing, things like breast-feeding are still biologically determined,” she said. “And in general, we tend to think that a breast-feeding mother would be accommodated.”

Amber Brown said her child remains on breast milk ahead of an October custody hearing before a judge.

“We latched right away since birth,” she said. “It’s been that way ever since.”

Alice Crites and Terence McArdle contributed to this report.