Why is it offensive and racist to shorten Pakistani to P**i?

Yet other countries shorten is acceptable eg Scottish is shortened to Scot and Afghanistani is shortened to Afghani.

Why is P**i racist but Afghani isn't?
Update: So far noone has answered my question.
6 answers 6