Pink Floyd were an English rock band formed in London in 1965. They achieved international acclaim with their progressive and psychedelic music. Distinguished by their use of philosophical lyrics, sonic experimentation, extended compositions, and elaborate live shows, they are one of the most commercially successful and influential groups in popular music history. Pink Floyd were founded by students Syd Barrett on guitar and lead vocals, Nick Mason on drums, Roger Waters on bass and vocals, and Richard Wright on keyboards and vocals.

In December 1967, the group added guitarist David Gilmour as the fifth member of Pink Floyd. Gilmour already knew Barrett, having studied with him at Cambridge Tech in the early 1960s. The two had performed at lunchtimes together with guitars and harmonicas, and later hitch-hiked and busked their way around the south of France. In 1965, while a member of Joker's Wild, Gilmour had watched the Tea Set. Morrison's assistant, Steve O'Rourke, set Gilmour up in a room at O'Rourke's house with a salary of PS30 per week (equivalent to PS500 in 2016), and in January 1968, Blackhill Enterprises announced Gilmour as the band's newest member; the second guitarist and its fifth member, the band intending to continue with Barrett as a nonperforming songwriter. Jenner commented: "The idea was that Dave would ... cover for [Barrett's] eccentricities and when that got to be not workable, Syd was just going to write. Just to try to keep him involved". In an expression of his frustration, Barrett, who was expected to write additional hit singles to follow up "Arnold Layne" and "See Emily Play", instead introduced "Have You Got It Yet?" to the band, intentionally changing the structure on each performance so as to make the song impossible to follow and learn. In a January 1968 photo-shoot of the five-man Pink Floyd, the photographs show Barrett looking detached from the others, staring into the distance. Working with Barrett eventually proved too difficult, and matters came to a conclusion in January while en route to a performance in Southampton when a band member asked if they should collect Barrett. According to Gilmour, the answer was "Nah, let's not bother", signalling the end of Barrett's tenure with Pink Floyd. Waters later admitted, "He was our friend, but most of the time we now wanted to strangle him". In early March 1968, Pink Floyd met with business partners Jenner and King to discuss the band's future; Barrett agreed to leave. Jenner and King believed Barrett to be the creative genius of the band, and decided to represent him and end their relationship with Pink Floyd. Morrison then sold his business to NEMS Enterprises, and O'Rourke became the band's personal manager. Blackhill announced Barrett's departure on 6 April 1968. After Barrett's departure, the burden of lyrical composition and creative direction fell mostly on Waters. Initially, Gilmour mimed to Barrett's voice on the group's European TV appearances; however, while playing on the university circuit, they avoided Barrett songs in favour of Waters and Wright material such as "It Would Be So Nice" and "Careful with That Axe, Eugene".Answer this question using a quote from the following article:

What was his role in the band prior to leaving?
a nonperforming songwriter.