Madge and the film director informed the judge that they resolved their differences just hours before they were set to appear in court on Wednesday, TMZ reported.

At the heart of the dispute was whether 16-year-old Rocco would continue living with his dad in London or with his mom.

Their legal showdown has been going on for years, with Madonna contending that Ritchie was too lenient with their son. Things came to a head in December when a New York judge granted Madonna’s request to have Rocco return to New York from London after he reportedly skipped out on the remainder of her Rebel Heart Tour and refused to board a U.S.-bound plane from Britain.

In March, a judge urged the exes to find an amicable resolution for Rocco’s sake.

By Nardine Saad and Jevon Phillips

Mother and son appear to have reconciled since then. She reunited with her firstborn son in London over the summer and he spent part of the season with her, going on a family vacation to Africa and celebrating the singer’s 58th birthday with her in Cuba last month.

The Grammy winner and Ritchie, who split in 2008, co-parent Rocco and their adopted son David, 10. The singer is also mom to daughter Lourdes from another relationship and adopted daughter Mercy. Ritchie has three children with his current wife, Jacqui Ainsley.

CAPTION

The Times spoke to fans who attended opening day screenings of "Black Panther" in Los Angeles to discuss what the film meant to them.

The Times spoke to fans who attended opening day screenings of "Black Panther" in Los Angeles to discuss what the film meant to them.

CAPTION

The Times spoke to fans who attended opening day screenings of "Black Panther" in Los Angeles to discuss what the film meant to them.

The Times spoke to fans who attended opening day screenings of "Black Panther" in Los Angeles to discuss what the film meant to them.

CAPTION

"Early Man" tells the tale of Dug, as he and his tribe encounter the Bronze Age.

"Early Man" tells the tale of Dug, as he and his tribe encounter the Bronze Age.

CAPTION

The Times asked celebrities at the Los Angeles "Black Panther" premiere to name as many black superheroes as they could.

The Times asked celebrities at the Los Angeles "Black Panther" premiere to name as many black superheroes as they could.

CAPTION

“Golden Exits” is an enveloping and beautifully acted ensemble piece about seven Brooklynites, most of whom never stop talking about how profoundly unhappy they are about their lives.

“Golden Exits” is an enveloping and beautifully acted ensemble piece about seven Brooklynites, most of whom never stop talking about how profoundly unhappy they are about their lives.

CAPTION

Kenneth Turan revews "Black Panther," a superhero movie whose characters have integrity and dramatic heft, and is filled with engaging exploits and credible crises grounded in a vibrant but convincing reality.

Kenneth Turan revews "Black Panther," a superhero movie whose characters have integrity and dramatic heft, and is filled with engaging exploits and credible crises grounded in a vibrant but convincing reality.