Kozlov was born into a peasant family in the small village of Zagorodnie. In 1919, he began working as mechanic in the nearby town of Zhlobin. He was conscripted for a two-year mandatory service in the Red Army in 1925, and joined the All-Union Communist Party in 1927. Kozlov attended the Minsk University between 1929 and 1933. After graduation, he served as a Kolkhoz party organizer for a year. During 1934, Kozlov was appointed director of the StarobinMachine and Tractor Station, located in the Salihorsk Raion. In 1937, he was posted as the First Secretary of the Communist Party's regional branch in Starobin. A year afterwards, he became the Party's First Secretary in the Chervyen Raion. In 1940, he was promoted to the deputy chairman of the Belorussian SSR's Council of People's Commissars. In April 1941, Kozlov was given the office of the Second Secretary in the Minsk Voblast's Communist Party branch.
Minsk was occupied by the invading Germans on 26 June 1941. Kozlov remained behind the enemy's lines and was appointed chief of the Voblast's underground Communist Party in July. He was tasked with organizing resistance activities, and led the Minsk partisans until the end of the German occupation. By mid-1942, he commanded a force that consisted of some 50,000 members. In September, he traveled to Moscow to report on the situation in Belarus. There, he was awarded the title Hero of the Soviet Union on 1 September 1942. As commander of one the occupied republic's largest partisan detachments, he was given the rank of a Major General on 16 September 1943. In July 1944, the Red Army liberated Minsk. Kozlov remained the chairman of the Minsk Voblast's Communist Party regional committee, an office he held for four further years.
Post-war years
On 12 March 1947, Kozlov was elected as the Chairman of Belarus' Supreme Soviet, functioning as such until 17 March 1948. Then, he became the Chief of the Supreme Belorussian Soviet's Presidium. He continued to serve in this post until his death. In addition, he was a candidate member of the Communist Party of the USSR's Central Committee during its 20th, 21st and 22nd convocations, from 25 February 1956 to 29 March 1966. On 8 April 1966, shortly before his death, he was accepted as a full member. Kozlov is buried in Minsk's Eastern Cemetery.