From February to April 1989, he participated in the Polish Round Table Talks along with his brother. After Solidarity's victory in the 1989 Polish legislative election, Kaczyński became a senator and vice-chairman of the movement. Then in the 1991 Polish parliamentary election, he was elected into the Sejm as a non-party member. He was also the main adviser and supporter of Lech Wałęsa when the latter was elected President of Poland in December 1990. Wałęsa nominated Kaczyński to be the Security Minister in the Presidential Chancellery but fired him in 1992 due to a conflict concerning Jan Olszewski's government. In 2003, Kaczyński co-founded the Law and Justice party, after splitting from the Solidarity Electoral Action and the Christian National Union, along with his brother. Kaczyński was the party's presidential candidate, during the 2005 Polish presidential election. In the first round of voting, Kaczyński received 33.1% of the valid votes. In the second round of voting, Kaczyński received 54.04% of the vote, defeating Donald Tusk, who received 45.96% of the vote. He was sworn in as president on 23 December 2005.