Joe Jonas and Sophie Turner have come to a temporary agreement regarding the custody of their two children as they work through their divorce.

Jonas, 34, and Turner, 27, asked a New York court to cancel their impending child custody trial after the pair came to an "amicable resolution" during a four-day mediation period, according to court documents obtained by Fox News Digital.

The children are set to move back and forth between their parents for weeks at a time through the end of 2023, the court documents stated. Turner will have custody of their two daughters from Oct. 9 through Oct. 21, Nov. 2 through Nov. 22 and Dec. 16 through Jan. 7.

Jonas will have the children from Oct. 21 through Nov. 2 and Nov. 22 through Dec. 16. Both Turner and Jonas are allowed to "temporarily travel" to the United Kingdom or anywhere in the United States during their time with the children.

SOPHIE TURNER BATTLES JOE JONAS FROM TAYLOR SWIFT-OWNED PAD, SEEN WITH PITBULL ATTORNEY WHO REPRESENTS ROYALTY

Sophie Turner looks down and texts as she walks the streets of Tribeca split Joe Jonas on a bike in New York City

Sophie Turner and Joe Jonas have struck a temporary custody agreement for their two daughters amid their divorce. (Gotham | Dia Dipasupil )

"After a productive and successful mediation, we have agreed that the children will spend time equally in loving homes in both the U.S. and the UK," a representative told Fox News Digital on behalf of Turner and Jonas. "We look forward to being great co-parents."

Jonas originally filed for divorce in a Florida court Sept. 5. 

"After four wonderful years of marriage, we have mutually decided to amicably end our marriage," the estranged couple later wrote in a joint statement. "There are many speculative narratives as to why, but truly this is a united decision, and we sincerely hope that everyone can respect our wishes for privacy for us and our children."

Shortly following the divorce announcement, things turned ugly when Turner sued Jonas in a New York court over custody of the children. She claimed she learned of the divorce filing "through the media," and said the marriage broke down "very suddenly" following "an argument" that occurred on the "Cake by the Ocean" singer's 34th birthday.

Joe Jonas and Sophie Turner pose for a photo

Joe Jonas and Sophie Turner were married for four years. (Bruce Glikas/WireImage via Getty Images)

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

Turner accused Jonas of "the wrongful retention" of their daughters for multiple days. The actress said Jonas' attorney, Thomas J. Sasser, acknowledged that the pop star wouldn't give up the kids' passports or "consent for the children to return home to England."

According to Turner, the couple had previously decided England would be the family's "forever home," but Jonas had the two children with him on his North American tour while the actress worked on a project. Turner had "hesitation" about this "temporary agreement."

Sophie Turner and Joe Jonas are divorcing

Joe Jonas filed for divorce from Sophie Turner on Sept. 5. (Getty Images)

At the time, a representative for Jonas released a statement disputing Turner's filing.

The statement claimed Turner had the children at the time in New York City, and after the two met to discuss custody, they had come to an agreement. However, "less than 24 hours later," Turner informed Jonas she wanted to move the children permanently to the United Kingdom, the representative stated.

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Sophie Turner in New York City

Sophie Turner initially accused Joe Jonas of "wrongful retention" of the couple's children. (Getty Images)

Jonas is "seeking shared parenting with the kids so that they are raised by both their mother and father, and is, of course, also OK with the kids being raised both in the U.S. and the U.K.," according to the statement.

While the divorce drama plays out, Turner has been staying in a New York City property owned by Taylor Swift. The "Midnights" singer had her own relationship with Jonas in 2008. The songs "Last Kiss" and "Mr. Perfectly Fine," both written by Swift, are believed to be about their short-lived romance.

These days, Turner seems to have become a part of Swift's girl squad. The two have been photographed out and about multiple times. Turner recently joined Swift, Blake Lively, Brittany Mahomes and others for dinner in New York. The next day, the group appeared at MetLife Stadium in New Jersey to cheer on Travis Kelce of the Kansas City Chiefs, Swift's rumored new boyfriend.

Ryan Reynolds cheered with Taylor Swift at the Kansas City Chiefs game

Sophie Turner attended a Kansas City Chiefs game alongside Taylor Swift. (Elsa)

CLICK HERE TO GET THE FOX NEWS APP