EXCLUSIVE: Ben Affleck and Jennifer Garner's divorce filing was 'only a matter of time,' source says

It's the end of an era -- but as a source tells ET, it was "only a matter of time."

Jennifer Garner officially filed for divorce from Ben Affleck, two years after announcing their separation, ET confirms.

WATCH: Ben Affleck and Jennifer Garner File for Divorce 2 Years After Separation

According to court documents obtained by ET, the 44-year-old actress, who has remained on good terms with Affleck throughout their separation, asked for joint legal and physical custody of the pair's three children -- 11-year-old Violet, 8-year-old Seraphina and 5-year-old Samuel.

A source close to Affleck and Garner tells ET that while the two are ready to legally end their marriage, "everything today couldn't have been done more amicably."

"The divorce filing was only a matter of time," the source revealed. "Ben and Jen are both still 100 percent committed to co-parenting their children and making sure their family situation works for them all. You can't have anything better than that."

Garner and Affleck announced their separation in June 2015, 10 years after tying the knot. News of Garner's divorce filing comes just one month after Affleck announced he had completed rehab for alcohol addiction, with the support of his estranged wife, "in order to be the best father I can be."

WATCH: How Jennifer Garner Helped Ben Affleck Turn His Life Around

Just one week earlier, a source told ET that while the two have "always remained civil," they would not be reconciling.

"They are doing this at the pace they need to for the best interest of their family," the source added.

Additional reporting by Jennifer Peros.

See more in the video above.