Riku-Ansem

Riku-Ansem is the form that Riku takes after he fails to capture Roxas under DiZ's request to awaken Sora. He summoned the dark power of Xehanort's Heartless in order to use it to capture Roxas because Roxas was beating Riku. He succeeds and take Roxas away where Organization XIII can not find him.

He continues to remain in this form throughout Kingdom Hearts II, and most people believed that he was Xehanort's Heartless until Kairi found out that he was Riku and revealed his identity to everyone.

After Sora and company catch up with Ansem the Wise, the Kingdom Hearts Encoder that Ansem the Wise uses to attempt to turn Kingdom Hearts into data. This plan backfires and during the explosion, Riku is transformed back into his normal form. It can be assumed that this explosion rids Riku of the presence of Xehanort's Heartless within him.

However, it also reduced his power of darkness, as revealed when they attempted to leave the World That Never Was and Riku failed to open a Corridor of Darkness.

Kingdom Hearts II
Mysterious wielder of the darkness.
 * Part I - Ansem

What could his true purpose be?

The form Sora's longtime friend Riku chose.
 * Part II - Riku

''Though Xehanort tried to control Riku from within, Riku's heart proved stronger. But the only way to wield darkness fully was to become it.''

''Riku began calling himself "Ansem", perhaps as a sign of resolve. He would live in darkness if that's what it took to wake Sora.''