Mozart did not write the libretto for Le Nozze di Figaro (The Marriage of Figaro, 1786). The text was written by Lorenzo Da Ponte (1749–1838), Italian poet and court librettist in Vienna.
Da Ponte adapted Pierre Beaumarchais's controversial 1784 play La Folle Journée, ou Le Mariage de Figaro—a sequel to The Barber of Seville, banned in Vienna for its anti-aristocratic satire. Da Ponte sanitized the politics, kept the comedy, and crafted Italian verse that sings.
This was the first of three Mozart–Da Ponte collaborations—arguably the greatest composer-librettist partnership in opera history:
Mozart: Music—melody, harmony, orchestration, vocal characterization, ensemble architecture.
Da Ponte: Text—drama, poetry, character voice, linguistic rhythm.
Mozart famously said he needed a poet who "understands music." Da Ponte was that poet. The marriage of their talents produced three operas that remain repertoire pillars 230+ years later.