McLaren driver Lewis Hamilton has apologised on Twitter for his 'Ali G' outburst after the Monaco Grand Prix.

Hamilton launched a furious attack on stewards after twice being penalised during his sixth-place finish.

Asked why, he replied, apparently in jest: "Maybe it's because I'm black. That's what Ali G says."

"Hey guys, I wanted to apologise for my performance and my comments after. I never meant to offend anyone," wrote Hamilton on the social networking site.

Hamilton received a drive-through penalty for a brush with Ferrari's Felipe Massa, and was later penalised 20 seconds for a late tangle with Pastor Maldonado of Williams - a penalty which did not affect the McLaren man's finishing position.

Immediately after the race, Hamilton said: "Massa held me up in qualifying, I got the penalty. He turned in to me [during the race], I got the penalty. These drivers are ridiculous. It's stupid."

quote In all honesty I will never stop racing the way I do. It's the way I do it

But Hamilton added on Twitter: external-link "To Massa and Maldonado, with the greatest respect I apologise if I offended you. Both of you are fantastic drivers who I regard highly."

Britain's Hamilton, who is second in the drivers' championship behind Monaco winner, Sebastian Vettel, added: "I would also like to say thank you to everyone on here, for their positive messages and also to the angry messages. I can respect them both."

Meanwhile, Hamilton has claimed he would be likely to walk away from F1 if he was ever forced to rein in his natural racing instinct.

"In all honesty I will never stop racing the way I do. It's the way I do it," said Hamilton.

"That's what got me here, it is the way I am. I don't do it to offend people or to hurt anyone. I do it because I love racing, and I feel like I can do it better than others.

"If it ever comes to a stage where I had to pull back and just cruise around, that would not excite me and I probably wouldn't stay around for that.

"I am here to race and win. If I have to lose that passion then it blows all racing."