The present invention relates to the pyrazoloquinazolinone and pyrroloquinazolinone derivatives of the general formula (I), as well as pharmaceutical compositions containing them, and their use in the treatment and/or prophylaxis of conditions associated with altered glutamatergic signalling and/or functions, and/or conditions which can be affected by alteration of glutamate level or signalling in mammals, in particular their use in the treatment and/or prophylaxis of acute and chronic neurological and/or psychiatric disorders.