To any unit form q(x)=∑i=1nxi2+∑i<jqijxixj, qij∈Z, we associate a Lie algebra G˜(q)—an intersection matrix Lie algebra in the terminology of Slodowy—by means of generalized Serre relations. For a nonnegative unit form the isomorphism type of G˜(q) is determined by the equivalence class of q. Moreover for q nonnegative and connected with radical of rank zero or one respectively, the algebras G˜(q) turn out to be exactly the simply-laced Lie algebras which are finite-dimensional simple or affine Kac–Moody, respectively. In case q is connected, nonnegative of corank two and not of Dynkin type An, the algebra G(q) is elliptic.