Leinster on verge of final eight after showing true grit in Castres
Leinster reasserted their control of Heineken Cup Pool One by ending Castres' proud 18-match home record at Stade Pierre-Antoine.
Castres' most recent home defeat was against Ulster last January and they fell to another Irish province here despite establishing a 14-0 lead and dominating the scrum.
The under-strength Castres team ended the first quarter in full control as full-back Brice Dulin touched down to add to Scotland and Lions lock Richie Gray's opening try.
Jimmy Gopperth scored two tries in response, the second coming in first-half injury time, as Leinster closed the gap to 17-12 at the interval.
It was a real war of attrition in the concluding 40 minutes and Matt O'Connor's men gained vital momentum on the hour mark, courtesy of three Gopperth penalties and a drop goal from Rob Kearney on his 50th Heineken Cup appearance.
Flanker Jordi Murphy then claimed his first European try to put the result beyond doubt, while Castres capitalised on Sean Cronin's sin-binning to score an injury-time consolation try through Remi Lamerat.
Having lost at home to Northampton in the previous round, Leinster needed to bounce back in order to keep hold of top spot and remain on course for the quarter-finals.
Castres were missing some notable names through injury - top-scoring scrum-half Rory Kockott and back-rowers Pedrie Wannenburg and Antonie Claassen chief among them - but their shadow side got off to a very strong start.
Flanker Ibrahim Diarra got his hands free to send centre Lamerat weaving through some lacklustre Leinster challenges. He was brought down in sight of the posts, before Seremaia Bai's long pass put the waiting Gray over in the left corner.
Television match official Derek Bevan confirmed the score which Cedric Garcia crisply converted.
The excellent Diarra then forced another turnover near halfway from which the French side sprung winger Remi Grosso into space on the left and with Rob Kearney drawn in, he passed inside for Dulin to finish off their second try.
Garcia's conversion left Leinster 14-0 adrift and with considerable ground to make up. Their forwards took up the baton, with Jordi Murphy held up short from a line-out maul.
From the resulting scrum, the Castres defence was caught off guard as Eoin Reddan passed for his half-back partner Gopperth to score by the posts, with the New Zealander also converting.
Goal-kicking scrum-half Garcia was on target in the 39th minute but the visitors - aided by a fine Fitzgerald run - got a timely boost when Gopperth shrugged off two tackles and stretched over under pressure from Gray to claim his second try.
Leinster won a central penalty for some needless stamping by Garcia when play resumed and the successful kick from Gopperth made it a two-point game.
Reddan soon sniped through on a break which led to a long-range drop goal from full-back Kearney, moving Leinster ahead for the first time, and Castres coughed up another penalty which Gopperth nudged home.
Leinster were suddenly 24-17 ahead when a 63rd-minute carry from replacement prop Cian Healy - a late inclusion on the bench after an incredibly quick recovery from ankle surgery - set up Gopperth's third penalty goal.
The Castres pack battered away in the Leinster 22 but the visitors, following a spell of desperate defending, countered for a brilliant third try.
Healy cut inside two tackles near the Castres 22 and passed for Murphy to dive over in the right corner in the 77th minute.
Although the win was now beyond them, Castres' persistence was rewarded in the dying seconds when Lamerat scrambled over from a close-in ruck.