Jennifer Garner has been supporting not only her ex-husband Ben Affleck but also his wife Jennifer Lopez amid the couple's rumored marital crisis.

An insider told Us Weekly that the two women's friendship has deepened in recent months, with Garner even becoming an "unexpected ally" to Lopez.

"She's been helpful to J.Lo, and they've been relating to each other. Jennifer has been a surprising person for J.Lo to talk to," the unnamed source claimed.

Fans began speculating in May that Lopez and Affleck's marriage may be on the rocks after noticing that the couple had not been spotted in public together in over a month.

Jennifer Lopez and Ben Affleck
Jennifer Lopez and Ben Affleck arrive for the premiere of "The Mother" at the Westwood Regency Village Theater in Los Angeles, California, on May 10, 2023.
(Photo : MICHAEL TRAN/AFP via Getty Images)

RELATED: Jennifer Garner's Boyfriend John Miller Asked Her To Stop Intervening In Ben Affleck's Marital Crisis: Report

Divorce rumors then started circulating after Affleck was photographed sans his wedding ring and moved out of their marital home in Beverly Hills and into a rental in Los Angeles' Brentwood neighborhood later that month.

While Lopez and Affleck have since reunited a handful of times, they continued to live separately and later quietly placed their shared home on the market -- just a year after purchasing it.

As the rumors ramped up, Garner was seen visiting Affleck at his rental home in late May.

At the time, an unnamed source told the Daily Mail that the "13 Going on 30" actress was trying to help save her ex-husband's marriage to Lopez.

Jennifer Garner
Jennifer Garner attends the premiere of Netflix's "Family Switch" at AMC The Grove 14 on November 29, 2023 in Los Angeles, California.
(Photo : Frazer Harrison/Getty Images)

RELATED: Ben Affleck Moved Belongings Out Of Marital Home While Jennifer Lopez Was In Europe: Report

"Jen does not want Ben to pull the plug on this marriage because she really does care about J.Lo," the insider said. "She did go to his house to talk to him about this and to try and keep the two of them together."

The source also claimed that Lopez confided in and sought advice from Garner because the multihyphenate entertainer "knows that she is one of the only people in the world who would understand what she is going through."

"[Garner] has been through it with the same man herself, and although the circumstances were quite different, it is still the same man and they both dealt with some of the same issues," the insider claimed.

Garner and Affleck were married from 2005 to 2018. But after finalizing their divorce, the pair have maintained an amicable relationship and regularly meet up as they co-parent their three children.

Jennifer Garner and Ben Affleck
Actress Jennifer Garner and actor-director Ben Affleck arrive at the Oscars at Hollywood & Highland Center on February 24, 2013 in Hollywood, California.
(Photo : Jason Merritt/Getty Images)

Affleck tied the knot with Lopez in 2022, just a year after rekindling their romance.

Neither Affleck nor Lopez has publicly commented on the state of their marriage since the speculations began.

However, some fans suggested that the singer-actress may have subtly sent her husband a message via social media over the weekend.

On Sunday, Lopez took to Instagram to share the music video for her 2021 song "Cambia El Paso."

While she indicated in the caption that she was simply celebrating the song's anniversary, the timing of the post had fans speculating that it may related to her rumored marital woes with Affleck.

"He doesn't deserve to have her in his arms," Lopez sings in the track. "Her life is better now without him."

A post shared by instagram