In 1858, Nakayama was a leader of courtiers protesting against the Treaty of Amity and Commerce between Japan and the United States, which opened the ports of Kanagawa, Kobe, Nagasaki, Niigata, and Hakodate to foreign trade and also to settlement by Americans. In December 1862, Nakayama was appointed as the Emperor's Special Consultant for National Affairs, but in 1864 he was sent away from court as a consequence of his involvement in the Kinmon Incident, an attempt to control the Emperor. However, this banishment was ended in January 1867 when Kōmei died unexpectedly and Nakayama's grandson, a boy aged only fourteen, came to the imperial throne.