Leinster survived a late fight back to beat the Dragons 22-18 and move into the play-offs on the back of an 18th victory in the RaboDirect Pro12 season.

Leinster will play the Glasgow Warriors in the play-offs next week in Dublin as the Irishmen finished their regular season on top of the table.

A try from prop Jack McGrath and points from the boot of fly-half Ian Madigan saw Leinster home. Flanker Dan Lydiate and Will Harries scored consolation tries for the Dragons at the end, adding to a couple of Lewis Robling penalties and a conversion from replacement centre Adam Hughes.

However, neither side had a great deal to play for as Leinster had already booked their play-off place as league leaders and the Dragons could only finish mid-table at best.

Leinster, despite resting some of their stars for next week's big play-off clash in Dublin, looked sharp and eager as they went nine points up inside the first quarter. Madigan made the Welsh region pay with three penalties inside the first 17 minutes while Robling countered with two of his own to keep the Dragons within three points of the Irish region.

But the initiative was firmly with Leinster, with big No.8 Leo Auva'a and skipper Kevin McLaughlin at the heart of their loose work.

Captain Luke Charteris, on his final match for the Dragons before leaving for France, though, nearly went over for the home side as they stepped up a gear and countered. But the 6ft 10in Wales international second-row was held up short, while scrum-half Wayne Evans dashed around the blindside of the resultant ruck only for his try to be ruled out for a Leinster penalty.

It was a lively first half which turned further towards Leinster when they grabbed the opening try of the match which was converted. The pack worked themselves into the home 22 before the ball found the hands of centre Noel Reid. His slick hands then gave loose-head prop McGrath his moment of glory as he rumbled over for a try from five metres.

Leinster had a couple of chances to add to their solitary try when lock Damian Browne led the charge before the ball went forward from a ruck near the home danger zone.

When the Irishmen had the ball in attacking situations their handling looked sharp and accurate and it was just one or two errors, like a forward pass here and there, which jammed up their moves. But they could not increase their lead any further as the sides went into the break with Leinster winning 16-6.

The Dragons had much more of the match at the start of the second half and nearly got their first try when wing Harries dashed to the line and only a desperate tackle denied replacement centre Pat Leach a touchdown in the corner.

Leinster seemed to be slowing down but Madigan picked the pace up again when he dashed through the home midfield on the halfway line and sent a possible scoring pass to wing Fionn Carr only for the receiver to drop the ball.

Madigan eventually broke the stalemate with his fourth and fifth penalties of the night, while Lydiate scored with four minutes left, with Hughes converting, and Harries came up with the ball under a pile of bodies in the dying seconds.

It means the Dragons' season is over, while Leinster march on towards a possible league title.