Why is the NH3 group of aniline acetylated before carrying out nitration?

In order to check the activation of the benzene ring by the amino group, first, it is acetylated with acetic anhydride or acetyl chloride in presence of pyridine to form acetanilide which can be further nitrated easily by the nitrating mixture.