Li had rebelled against the rule of Yang You's grandfather Emperor Yang of Sui in 617 and captured the capital Chang'an later that year, seizing Yang You and installing Yang as a puppet emperor. However, only the commanderies under Li's control recognized Yang You as emperor. The rest of the commanderies continued to recognize Emperor Yang of Sui as emperor. In 618, after news arrived that Emperor Yang had been killed by the general Yuwen Huaji, Li had the young emperor yield the throne to him. Li then murdered and executed Yang You a year later.