The aim of this work is to study a decomposition theorem for rings satisfying either of the properties xy = x^pf(xyx)x^q or xy = x^pf(yxy)x^q, where p = p(x,y), q = q(x,y) are nonnegative integers and f(t) ∈ tZ[t] vary with the pair of elements x, y, and further investigate the commutativity of such rings. Other related results are obtained for near-rings.