The present invention relates to therapeutically active azacyclic or azabicyclic compounds, a method of preparing the same and to pharmaceutical compositions comprising the compounds. The novel compounds are useful as stimulants of the cognitive function of the forebrain and hippocampus of mammals and especially in the treatment of Alzheimer's disease.