Once the war was over, Senghor was selected as Dean of the Linguistics Department with the École nationale de la France d'Outre-Mer, a position he would hold until Senegal's independence in 1960. While travelling on a research trip for his poetry, he met the local socialist leader, Lamine Guèye, who suggested that Senghor run for election as a member of the Assemblée nationale française. Senghor accepted and became député for the riding of Sénégal-Mauritanie, when colonies were granted the right to be represented by elected individuals. They took different positions when the train conductors on the line Dakar-Niger went on strike. Guèye voted against the strike, arguing the movement would paralyse the colony, while Senghor supported the workers, which gained him great support among Senegalese.
Since federalism was not favoured by the African countries, he decided to form, along with Modibo Keita, the Mali Federation with former French Sudan (present-day Mali). Senghor was president of the Federal Assembly until its failure in 1960.
Afterwards, Senghor became the first President of the Republic of Senegal, elected on 5 September 1960. He is the author of the Senegalese national anthem. The prime minister, Mamadou Dia, was in charge of executing Senegal's long-term development plan, while Senghor was in charge of foreign relations. The two men quickly disagreed. In December 1962, Mamadou Dia was arrested under suspicion of fomenting a coup d'état. He was held in prison for 12 years. Following this, Senghor created a presidential regime.