Morena Baccarin's Ex Found Out About Pregnancy With Ben McKenzie a Week Ago

This video is unavailable because we were unable to load a message from our sponsors.

If you are using ad-blocking software, please disable it and reload the page.

As Morena Baccarin and her ex battle in court over custody of their young son, new details have been revealed about the 36-year-old actress' pregnancy with her Gotham co-star, Ben McKenzie.

During a court appearance on Thursday, an attorney for Baccarin's ex, Los Angeles-based producer/director Austin Chick, claimed that they had only just found out about Baccarin's pregnancy last week, when the actress was 13 weeks along. A rep for McKenzie confirmed to the press earlier that day that he and Baccarin are expecting a baby together, but kept mum on any additional details.

PHOTO: Morena Baccarin Hides Her Baby Bump on the 'Gotham' Set

After tying the knot in 2011, Chick filed for divorce from Baccarin on June 12 of this year citing "irreconcilable differences."

During court proceedings on Thursday, an attorney for Baccarin claimed that the former couple had previously made the decision to move to New York as a family after she accepted her role on Gotham. Baccarin became a series regular on the show in February and the pair began to experience marital discord by March, her lawyer claims. Around that time, the couple allegedly considered living in two separate New York residences.

Baccarin was seeking a temporary agreement regarding custody of the couple's son, Julius, who will have his second birthday in October. As ETonline previously reported, Baccarin has so far suffered a "difficult pregnancy," her lawyer said, and will be unable to fly in just a few months.

Ultimately, the judge ordered joint legal custody, with the child temporarily based in New York with Baccarin until she finds out whether Gotham will be renewed for a third season by Fox. In the meantime, the actress will also pay for travel and a New York apartment for Chick during his visits. (Chick's lawyer made it clear during proceedings that his client does not want to move to New York.) Chick is also entitled to take the child back to Los Angeles every two months for one week at a time, given he provides written notice 15 days in advance.

WATCH: Morena Baccarin and Her Ex Face-Off in Court -- Bringing the Actress to Tears

Baccarin's lawyer said that she's "in a new relationship and is moving on with her life," and McKenzie's family appears to be welcoming her with open arms. The 37-year-old actor re-tweeted a post from his sister, Camille Schenkkan, on Thursday, reading: "Welcome to the family, Morena! Also... I'M GONNA BE AN AUNT."

WATCH: 'Gotham' Co-Stars Morena Baccarin and Ben McKenzie Are Expecting a Baby

Baccarin and McKenzie's fictional Gotham characters became romantically involved on the show at the end of the first season. Last Friday, the pair was spotted filming a scene together in Brooklyn, with Baccarin covering her burgeoning baby bump with a long, white coat.

Gotham returned to Fox for its second season on Monday, Sept. 21.