It's against the law to commit burgulary.
told a radio interviewer that the Mexican government was going to file lawsuits against the United States if our National Guard detains any Mexicans trying to sneak into our country.
It's also against the law to enter the US illegally.
Does the National Guard have the authority to detain a person entering the US illegally?
I think the answer is No.
One example is about "preventing entry" and the other is about "detaining"
If they detain anyone they are breaking the law. Unless they have the authority.
So the examples are "not the same"

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic