Sofia Vergara just got a huge W in her frozen embryo battle with her ex -- a judge dismissed the case, saying Nick Loeb had no business suing her in Louisiana ... TMZ has learned.
According to docs, the judge said the court had no jurisdiction because the embryos were conceived in California, and neither parent has any permanent ties to the state. Sofia shot a movie there in 2014. Nick claimed they'd dated and planned their life together in the state, but the court didn't buy that.
In the docs, the judge noted Loeb probably only filed in Louisiana because of its favorable laws pertaining to the rights of unborn children ... but there's no getting around the whole jurisdiction issue.
The judge actually called the pre-embryos "citizens of California" ... and said weighing in on the case would require a potential constitutional evaluation over the embryos' rights.
As we reported ... Sofia filed docs in February asking the court to end the embryo war.
It's unclear if Loeb intends to refile. We've reached out to his team, but no word back yet.