Battle of Baekgang
In the Bureau of Onmyō, a was established, with a Head of Onmyō at the top, administrative officers below him, and technical officers such as doctors, trainees, and other general staff. However, since the technical officers, such as doctors and onmyōji, were in charge of technology that had been introduced from the continent, they were appointed by foreigners who were well versed in academics and skilled in reading Classical Chinese texts, especially monks who had come from the Han dynasty and the Sui dynasty in mainland China, as well as from Goguryeo and Baekje, which had power on the west coast of the Korean Peninsula, and rarely from Silla, which initially had power on the east coast of the Korean Peninsula. In particular, around the time of the defeat of the Baekje dynasty in the Battle of Baekgang in 663, when Japan sent reinforcements to Baekje, a close ally of Japan, and Silla unified the Korean Peninsula, a large number of knowledgeable people from Baekje came to Japan as exiles, and many of them were appointed to the bureau. It was also possible to appoint technical officers from the civilian population.