Urea is formed in the liver through the urea cycle when excess amino acids are broken down. The nitrogen from amino acids is converted into ammonia, which is toxic. The liver converts ammonia into urea, which is less toxic and can be safely excreted by the kidneys.