Napoleon came to distrust his Spanish ally and forcibly replaced the king of Spain with his own brother, Joseph Bonaparte.
Joseph Bonaparte was put on the Spanish throne by his brother, Napoleon.