Asterisk. Punctuation. Arrgh.

Do asterisks go before or after the period or other marks at the end of
a sentence*?

*I was pretty sure I had this figured out, but then I started having
second thoughts**.

**The asterisk modifies the word or sentence, while the punctuation
mark just ends it, so I think it should be closer***.

But I could be wrong****!

*****Kill me.