Sofia Vergara just won a huge victory in her years-long battle with an ex over their frozen embryos -- a judge permanently blocked Nick Loeb from using them with a surrogate.
The 'Modern Family' star won big in L.A. County Superior Court, where Nick Loeb had been fighting tooth and nail for permission to bring the embryos to term, even going so far as trying to take custody of them through a trust ... and giving the fertilized eggs names in a lawsuit.
Welp, the judge said that ain't gonna happen ... at least not without Sofia's consent. The judge granted a permanent injunction -- saying the contract they both signed with a fertility clinic back in 2013 remains valid.
Because of that, the court said Nick can't try to use the embryos for his own purposes and give them rights -- which he tried to do in a Louisiana court, essentially arguing the embryos should be recognized as people with rights.
He recently got shot down there as well -- and now, he's lost again in L.A., where this whole mess started not too long after he and Sofia split in 2014. With the order in place and the original contract upheld, Nick will have to get Sofia's consent for anything having to do with the embryos.
Of course, Sofia's married to Joe Manganiello now ... and only has one child to date from a previous relationship.