“Make sure you and all your pals get out to vote.”
The actor was born in Scotland and made it clear he is supporting the SNP at the Scottish Parliament election on May 6.
After receiving lots of attention for his vocal support for the SNP Mr Compton took to Twitter and wrote: “I see Scottish Tory Twitter and their bots enraged an actor would express an opinion.
“Actors and artists should be allowed to do so freely.
“Art holds a mirror up to our society and Line of Duty did that brilliantly last night with its ending being a commentary on political corruption.
“Thank you for your work.”
Ms Sturgeon needs a majority in the Scottish Parliament in order to give strength to her call for a second Scottish independence referendum.
The May 6 Scottish election is being used by the SNP as a de factor vote on independence.
Leader Ms Sturgeon has also repeatedly threatened to rejoin the EU if Scotland goes it alone.
She hopes the SNP secure a majority in the coming election show she has the mandate to demand a vote on Scottish independence.
This vote would come just seven years after the 2014 referendum were Scotland voted in favour of remaining in the UK.