Why is cannabis legal in some countries but not others?

Marijuana is not completely legal in any country there are laws that say its okay to possess and use it if you dont have a lot, but on a federal level the government does not want you to have it at all.