It's a product of treaty, in this case the Vienna Convention on Diplomatic Relations from 1961.
Treaty is the same basis for excluding Indians - our dealings with them them were goverened by treaty.
And who affirms treaties... it isn’t the Treaty Fairy