In 870, he passed the government official examination and was appointed to the Shorokuinojo (Senior Sixth Rank, Upper Grade), became the Genbanosuke (Assistant Director of the Bureau of Buddhism and Diplomacy) the following year, and later was transferred to be the Shonaiki (a position at the Ministry of Central Affairs that required excellent writing skills).
貞観12年（870年）、方略試に合格し正六位上に叙せられ、翌年には玄蕃助、さらに少内記に遷任。