Mayor Eric Garcetti of Los Angeles tested positive for the coronavirus on Wednesday as he was attending a conference on climate change in Glasgow.The mayor’s Twitter account announced the positive test:The conference — COP26, organized by the United Nations — brought together world leaders and other delegates to set goals for cutting greenhouse gas emissions. Mr. Garcetti was attending as the chair of C40, a group of mayors from around the world who want to deliver action on climate change.The conference required participants from outside Britain to take both a rapid coronavirus test and a more sensitive P.C.R. test upon arrival in the country. Each day of the conference, participants also had to self-administer a rapid test and register a negative result online in order to be able to enter the event’s main venues.Harrison Wollman, the mayor’s press secretary, wrote in an email that Mr. Garcetti “was taking regular rapid antigen tests daily while at the conference, and those all came back negative. He took a PCR test in preparation for his flight home, and that result was positive.”Mr. Garcetti spoke on Monday at the World Leaders Summit and on Tuesday at a C40 event. He skipped some events on Wednesday and isolated himself in his hotel room after he tested positive.As for how long the mayor would remain there, Mr. Wollman said, “We are still determining next steps, but the mayor will follow the advice of British public health experts.”Frustrations among attendees over long security lines at the conference have been mounting — some complained that they had to wait in line for more than an hour. Verification of negative tests and capacity limits for meeting rooms were contributing to the logistical problems.Masks were required at the conference, but attendees could be seen with their masks lowered rather than covering their mouths and noses, and there was no social distancing. The crowded conditions fueled concerns that poor air circulation in the conference venues could create an environment conducive to spreading the virus.Organizers of the conference released a letter on Tuesday apologizing for the difficulties.