After a rough few months since their early exit from the World Cup, and a particularly harrowing fortnight in which the team have had to deal with the walk-out of stand-off Finn Russell, Scotland demonstrated huge character to push Ireland all the way in a scrappy but absorbing Six Nations curtain-raiser.

But they didn’t do quite enough to secure a first win in Dublin in 10 years, with several soft penalties and some poor defending in the lead-up to the game’s only try costing the team dearly.

Gregor Townsend’s team will also be kicking themselves that they failed to turn pressure into points on the half dozen occasions they too came within five yards of the Ireland line.

There was much to admire about this performance from a Scottish perspective – not least the set-piece and the battling spirit exhibited by the players from the first minute to the last – but in the final analysis, the failure to turn a number of possessions on the Irish line into five or seven points, and too many cheap points coughed up through disciplinary and/or concentration lapses, will haunt the team during their debrief.

At least three soft penalties within easy kicking range for Jonny Sexton were conceded, and while defence was generally solid there was a bad lapse which allowed the Irish in for the game’s only try with just under 10 minutes played – meaning the visitors were always chasing this game. Plenty to build on for next week’s Calcutta Cup clash at Murrayfield, and lots of lessons to learn.

One of Scotland’s biggest issues in recent years has been the concession of soft points early on, but they flew out of the blocks here, and took the lead through an Adam Hastings penalty from in front of the posts after James Ryan was called for going off his feet to compete for the ball on the deck.

The host team also lost debutant No.8 Caelan Doris during those frantic opening exchanges, after he was knocked-out whilst tackling Hastings, which must have been a huge disappointment for the player, but his team-mates won’t have been overly perturbed to see Peter O’Mahony – the man who led the Lions to a Test series draw against the All Blacks in 2017 – trotting off the bench, and they snatched the lead on nine minutes.

That score came from a neat but basic out-the-back move which opened up a yawning gap on the left for Sexton to waltz through unchallenged. It was a well-worked score, but Scotland’s new defence coach Steve Tandy will have been furious that so many blue jerseys were snoozing on the wrong side of the ruck.

Hastings narrowed the gap to a point with a well-struck 40-yarder from a scrum penalty, and had another opportunity 10 minutes later when Conor Murray was guilty of holding on, but this time his long-range effort strayed to the right of the posts, and it was Ireland who scored next when Ali Price was penalised for an off-side and Sexton slotted the easy three points.

With three minutes left in the half, Sam Johnson anticipated Murray’s pass for an intercept on his own 22, then Hastings and Sean Maitland lent their support in a breakout which went all the way up to the opposition 22. When the home cover eventually snuffed that move out, blue jerseys were there in numbers to retain possession. Hastings did well to first of all take the ball at ankle level and then pick out impressive new- boy Nick Haining with a clever kick-pass – but the move fizzled out when Zander Fagerson was penalised for holding on.

The first half could not have gone much better for Scotland, but they were still four points down.

Two ruck penalties – the first against Rory Sutherland almost immediately from kick-off, and the second against Jamie Ritchie for not getting out of the way quickly enough after a tackle right in front of the posts – allowed Ireland to roll into gear at the start of the second half with another Sexton three points. But Scotland did not allow that to divert them from the task in hand, and some excellent continuity play on the Irish line finally prised open space on the right for what should have been a nailed-on try for a player of the experience and calibre of Stuart Hogg, but astonishingly – and excruciatingly – the Scotland captain lost control in the act of grounding, despite being under no pressure at all.

Scotland had to make do with another Hastings penalty for an infringement earlier in that move, which was some consolation and put them back to within four points. Sexton cancelled that out when Ritchie was penalised again for interfering with the ball on the deck after a tackle in front of his own posts, and the see-saw pattern continued when CJ Stander went off his feet and Hastings nailed the points.

As the game moved into the final 10 minutes, it was finely balanced, and the decisive moment came when Johnson deliberately tried to edge Andrew Conway off his stride as he chased a kick ahead. The Irish winger didn’t need a second invitation to hit the deck and while Hastings was clearly furious afterwards at Conway’s amateur dramatics there was no doubt there had been unnecessary contact.

Scotland piled everything into one final tilt at glory, with Stuart McInally and Hamish Watson leading the charge as play surged towards the Irish line, but the blue jerseys couldn’t make that crucial final six inches, and twice they lost the ball on the deck during a tense last three minutes.

Scorers, Ireland – Try: Sexton. Con: Sexton. Pens: Sexton 4.

Scotland – Pens: Hastings 4.

Scotland: S Hogg; S Maitland, H Jones (C Harris 64), S Johnson (R Hutchinson 72), B Kinghorn; A Hastings, A Price (G Horne 64); R Sutherland (A Dell 64), F Brown (S McInally 45-50, 56), Z Fagerson (W Nel 72), S Cummings, J Gray (B Toolis 64) J Ritchie, H Watson, N Haining (C du Preez 72).

Ireland: J Larmour; A Conway, G Ringrose (R Henshaw 40), B Aki, J Stockdale; J Sexton (R Byrne 72), C Murray (J Cooney, 59); C Healy (D Kilcoyne 49-51, Porter 65), R Herring (R Kelleher 72), T Furlong (C Healey 77), I Henderson (D Toner 66), J Ryan, C Stander, J van der Flier, C Doris (P O’Mahony 4).

Referee: Mathieu Raynal (France)