Madonna has issued a defiant response after she lost legal efforts to have teenage son Rocco live with her rather than his father Guy Ritchie.

It was announced in New York on Wednesday that the former couple had resolved their bitter custody dispute over the 16-year-old.

Madonna appears to have referred to the case by posting messages on Twitter and Instagram about being a mother.

Posting a photo of herself in a black hoodie, with an image of a crown over her head and the word "bitch" scrawled across her front, she wrote: "Because sometimes soccer moms need to be a.........."

Another posting followed, with the same photo and the words "and be treated like a Queen".

Court spokesman Lucian Chalfen confirmed in New York that the divorced singer and her film-maker ex had reached a settlement.

Ritchie's lawyer later said that Rocco will continue to live with his father in London.

The dispute began after Rocco remained in London with his father after visiting the UK on with Madonna on her world tour.

He refused to return to the US to be with his mother for Christmas.

Madonna and Ritchie took the battle to the courts, opening litigation in New York and London.

In December a judge ruled that Rocco should return to his mother's custody, but decided not to issue a warrant to enforce the order. Rocco has since remained in London with his father and enrolled in a school in the capital.

During a hearing in Manhattan, State Supreme Court Justice Deborah Kaplan had implored Madonna, 58, and Ritchie, 47, to settle the matter privately.

"No one is disrupting his household other than the inability of the parents to reach a resolution," Ms Kaplan said. "If they cannot resolve this matter then eventually the court will."

Ellen Sigal, a court-appointed lawyer for Rocco, said in March that the dispute was causing the teenager stress.

"It's been a very difficult time for him," she said in court. "We hope to put an end to this as soon as possible without exposing him to more litigation, press innuendo, any of that kind of thing."

Ritchie and Madonna divorced in 2008. They also have a 10-year-old son David, who they adopted from Malawi.

The Lock, Stock and Two Smoking Barrels director has now remarried, tying the knot with model Jacqui Ainsley last year. They have three children together.