Drop high power terms in Matrix multiplication?

Hi guys,

I am using Wolfram Mathematica. Basically I am doing a multiplication of 2 3x3 Identity Matrix which consist on quadratic functions. But after multiplying both matrices, I attained a highest power of 4 in the functions. But I would only like to retain up to power of 2 in the result. Is there any way I can do that in Wolfram Mathematica?

If m1 and m2 are your matrices try

Expand[m1.m2] //. a_. x^(m_ /; m >= 3) -> 0

Thanks for the advice, Hans, it worked for me.