Lena Headey Son Must Return to the US of A ...

10/26/2016 3:12 PM PDT

Lena Headey's Son Must Return to the US of A

EXCLUSIVE

Lena Headey violated her custody agreement with her ex-husband by keeping their son in the U.K., and a judge has just ordered her to come back to L.A. with the kid after the show wraps.

Ex-hubby Peter Loughran was in court Wednesday when the judge made it clear ... the 'GoT' star went crosswise with the 2013 custody agreement by enrolling 6-year-old Wylie in school without Peter's permission.

Peter wanted Wylie returned stat -- the boy was supposed to come back Sept. 5th -- but the judge agreed with Lena that she could keep Wylie in Europe until shooting is over before returning to L.A.

Lena wanted to keep Wylie in England permanently, because she felt the U.S. school system sucked.

The custody agreement gives Peter visitation 10 days a month. Until Wylie comes back home, Lena has to pay for Peter's travel.

TMZ broke the story ... Peter got pissed when Lena moved with their kid to the U.K. after she claimed he agreed they'd both live there and share custody.