Apicomplexa
The presence of alveoli and other traits place the Apicomplexa among a group called the alveolates.  Several related flagellates, such as Perkinsus and Colpodella, have structures similar to the polar ring and were formerly included here, but most appear to be closer relatives of the dinoflagellates.  They are probably similar to the common ancestor of the two groups.