An antimicrobial and/or antiviral polymer is provided. The polymer is a modified polymer of a precursor polymer that comprises nitrogen atoms. The precursor polymer is modified into the antimicrobial and/or antiviral polymer of the present invention by substituting at least part of the nitrogen atoms with a (C1-C20) alkyl group and quaternizing at least part of the substituted nitrogen atoms. Such antimicrobial and/or antiviral polymers bind strongly and non-covalently to surfaces, rendering the surface antimicrobial and/or antiviral.