Novel heterocyclic compounds of the formula: ##STR1## or pharmaceutically acceptable acid addition salts thereof having a more potent and longer lasting cytoprotective anti-ulcer action than known analogues, useful in the treatment or prophylaxis of gastric ulcer at an oral dose of 10-500 mg, preferably 20 mg-100 mg per day to an adult, are provided through several routes.