Our story begins in 1875, when the Qing court made Taipei a prefecture city for northern Taiwan. A prefecture needed a proper Confucius temple, and in 1879 construction began inside the southern gate of the city. Two temples were planned, a literary temple on the left and a martial temple on the right, both facing south. Two officials oversaw the work: Xia Xianlun, the military commissioner for Taiwan, and Chen Xingju, the Taipei prefect. By 1881 the main hall, the Yi Gate and the Chongsheng Shrine were finished. Then the gentry of Taipei suggested raising donations, and work began on the Li Gate, the Yi Path, the Lingxing Gate, the Pangong Pond and a surrounding wall. In 1884 the temple was finally complete. The temple is said to be modeled on the original Confucius temple in Qufu, in Shandong. In the years that followed, while Liu Mingchuan was governor of Taiwan, a major ceremony was held at the temple every year, an important event for the scholars of the day.