The Lu state was headed by a ruling ducal house.
Under the duke were three aristocratic families, whose heads bore the title of viscount and held hereditary positions in the Lu bureacracy.
The Ji family held the position "Minister over the Masses", who was also the "Prime Minister"; the Meng family held the position "Minister of Works"; and the Shu family held the position "Minister of War".
In the winter of 505 BC, Yang Hu—a retainer of the Ji family rose up in rebellion and seized power from the Ji family.
However, by the summer of 501 BC, the three hereditary families had succeeded in expelling Yang Hu from Lu.
By then, Confucius had build up a considerable reputation through his teachings, while the families came to see the value of proper conduct and righteousness, so they could achieve loyalty to a legitimate government.
Thus, that year (501 BC), Confucius came to be appointed to the minor position of governor of a town.
Eventually, he rose to the position of Minister of Crime.
Confucius desired to return the authority of the state to the duke by dismantling the fortifications of the city strongholds belonging to the three families.
This way, he could establish a centralized government.
However, Confucius relied solely on diplomacy as he had no military authority himself.
In 500 BC, Hou Fan, the governor of Hou, revolted against his lord of the Shu family.
Although the Meng and Shu families unsuccessfully besieged Hou, a loyalist official rose up with the people of Hou and forced Hou Fan to flee to the Qi state.
The situation may have been in favor of Confucius as this likely made it possible for Confucius and his disciples to convince the aristocratic families to dismantle the fortifications of their cities.
Eventually, after a year and a half, Confucius and his disciples succeeded in convincing the Shu family to raze the walls of Hou, the Ji family in razing the walls of Bi, and the Meng family in razing the walls of Cheng.
First, the Shu family led an army towards their city Hou and tore down its walls in 498 BC.
Soon thereafter, Gongshan Furao[a], a retainer of the Ji family, revolted and took control of the forces at Bi.
He immediately launched an attack and entered the capital Lu.
When it was time to dismantle the city walls of the Meng family, the governor was reluctant to have his city walls torn down and convinced the head of the Meng family not to do so.
The Zuo Zhuan recalls that the governor advised against razing the walls to the ground as he said that it made Cheng vulnerable to the Qi state and cause the destruction of the Meng family.
Even though Viscount Meng Yi gave his word not to interfere with an attempt, he went back on his earlier promise to dismantle the walls.
Later in 498 BC, Duke Ding personally went with an army to lay siege to Cheng in an attempt to raze its walls to the ground, but he did not succeed.
Thus, Confucius could not achieve the idealistic reform that he wanted and restore the legitimate rule of the duke, returning to the period of the Duke of Zhou.
As a result of his unusual degree of success, Confucius made powerful enemies within the state, especially with Viscount Ji Huan.
According to accounts in the Zuo Zhuan and Shiji, Confucius departed his homeland in 497 BC after his support to the failed attempt of dismantling the fortified city walls of the powerful Ji, Meng, and Shu families.
He left the state of Lu without resigning, remaining in self-exile and unable to return as long as Viscount Ji Huan was alive.