Nicotine is an alkaloid found in the Solanaceae family of plants. (The "Solanaceae" family includes some of the most poisenous plants known, as well as some of the most delicious fruits and vegetables, like Tomato, Peppino, Potato, Eggplands, etc).  Nicotin is also found in Tobacco.

It works as an anti-herbivore chemical and was used as an insecticide. Today, imidacloprid, a Nicotin analog, replaced it and is very widely used as a Systemic Insecticide.

Dr.George Tsambourakis