He pursued Chinese and Dutch studies and the study of medicine under Umeda Yusai, Hirose Tanso, Ogata Koan, Okuyama Seishuku, and the German doctor von Siebold.
In 1853 he entered the service of the domain of Uwajima, Shikoku, supervising military preparations, the translation of works on military subjects, and the construction of warships. In 1856 he went to Edo and opened a school called the Kyukyodo, but shortly after he was invited to become an instructor in the shogunal office for the handling of foreign books, and the following year was transferred to the Kobusho, a military academy that had recently been established by the shogunate.
In 1860 he entered the service of the domain of Choshu, training students in Western studies, and in 1866, when the shogunate dispatched forces to conduct a punitive expedition against Choshu, Masujiro led the soldiers of the domain and successfully repulsed them.
Under the new government formed at the time of the Meiji Restoration he served with distinction as an official in the office of military defense, and in 1869 was appointed hyobu-tayu (vice-minister of war) and put in charge of the reform of the military system. In the ninth month of the same year he visited Kyoto to conduct a study on the manufacture of machines and the establishment of a naval academy, and while there was attacked by a group of Choshu samurai headed by Kumashiro Naoto. He died shortly after of his wounds.