mechanism

a system or means for doing something; especially, a physical or mental process, whether conscious or unconscious, by which some result is produced, e.g. a defense mechanism.