The Temple massacre was a violent attack on the Temple by the Man in Black, in the form of the Monster, in order to kill the Others who would not join him. He used Claire and Sayid to assist in the battle.
Sayid was shot by Roger Linus in 1977 after time traveling. ("The Incident, Part 1") After returning to 2007, he was brought to the Temple and submerged in its pool by Dogen, and seemingly drowned. Two hours later, he awoke, alive. Dogen was informed that Jacob was dead and the Others took defensive measures, spreading ash circles around the Temple. ("LA X, Part 2") Dogen later tried to get Jack to kill Sayid with a poisoned pill, saying Sayid had been "claimed" by a "darkness" that had also taken Claire. ("What Kate Does")
Meanwhile, the Man in Black's centuries-long plan to kill Jacob succeeded when he used Ben to stab Jacob to death. ("The Incident, Part 2") After that, the Man in Black recruited Sawyer to his cause, then went to meet with his "friend" Claire. ("The Substitute") ("Lighthouse")
At the Temple, Jack and Hurley were sent by Jacob on special mission sparing them from the massacre. Kate and Jin had also left to follow Sawyer. Kate, however, would later return. Meanwhile, Ilana's party began their journey to the Temple after burying John Locke. ("What Kate Does") ("The Substitute") ("Lighthouse")
Prior to the massacre
Sayid confronted and fought Dogen when the latter informed him of his condition. Claire arrived at the Temple and said "he," the Man in Black, wished to speak to Dogen. Dogen refused and instead sent Sayid, giving him a knife and informing Sayid that he had to stab the Man in Black before he spoke. Sayid encountered the Man in Black and stabbed him, but this did nothing. The Man in Black claimed Sayid had been sent here by Dogen in hopes he would be killed. Instead, the Man in Black offered Sayid an alternative.
Sayid returned to the Temple baring a message: if they did not leave the Temple and join the Man in Black by sundown, they would be killed. A handful of Others, including Cindy, Zach and Emma, are seen fleeing the Temple. ("Sundown")
At sundown, Sayid found Dogen by the pool where he had been healed. Dogen told Sayid about his life before the Island and his son. After telling him about the death of his son, Dogen informed Sayid that Jacob (or someone claiming to be Jacob) had made an offer that would heal his son. He then asked Sayid if the Man in Black had made a similar offer about a loved one, to which Sayid replied he had. Suddenly, Sayid threw Dogen and drowned him in the pool. Lennon entered the room and saw Dogen floating. He then shouted that Dogen was the only thing keeping the Man in Black out, and after that had his throat slit by Sayid. The Man in Black, in the form of the Smoke Monster, came smashing into the Temple and began murdering the large group of Others who decided to stay, hurling them against pillars and walls.
While this chaos was occuring, Kate found Claire and tried to get her to leave, but Claire told Kate that they'd be safer in the pit. Kate lept into Claire's pit right as the Monster came barreling past her. Miles fled and encountered Ben, Ilana, Sun and Frank. Ilana calmly led them to the secret tunnel Hurley had used previously, and hid everyone in the secret passage as the Monster roared through the hallway. Ben found Sayid by the pool and realized he was not the same, then fled in fear. Sayid, Kate and Claire exited the Temple in the aftermath of the massacre to find many Others slain. They left the Temple to find Cindy and the kids along with at least a dozen Others standing with the Man in Black, having been aligned with him, and set off into the jungle. ("Sundown")