The missing word in the sentence is “entanglement”. So it should read:
“Magellan lost the favor of the king of Portugal when he became involved in a political entanglement.”