I would be very grateful if someone could explain to me how hidden markov models are used to generate a sequence alignment. I was trying to read on it, however ended up in attaining basic concepts and I'm interested in the mechanism that takes place in between the two points: I input 2 or more sequences (first) and get the alignment on my screen (second). I don't really understand the way an HMM is generated in the case of performing sequence alignments.

I'll be thankful even if someone could provide me with links to sources to read on the subject.

I will be very grateful for any help,

Thank you.