Barack Obama sent a sweet congratulatory message to Jennifer Lopez and Alex Rodriguez following their engagement.

The pop star and actress and the former baseball player became engaged earlier this month after two years of dating.

The former president of the United States was one of the many to share his joy over the famous couple’s engagement, as revealed by Rodriguez.

View this post on Instagram

This means the world to us. #44

A post shared by Alex Rodriguez (@arod) on

He posted a picture of a handwritten note from Mr Obama on Instagram, which said: “Michelle and I just wanted to congratulate you on your engagement.

“After 26 years together, we can say that whatever challenges life may bring, sharing them with someone you love makes it all better.”

He signed off by writing “all the best” along with his cursive signature.

Rodriguez wrote: “This means the world to us. #44.”

Rodriguez, 43, surprised Lopez, 49, with a 16-carat diamond ring while they were on holiday in the Bahamas.

Announcing the news, both shared an image on Instagram of the star’s hand bearing the ring.

“She said yes”, Rodriguez wrote, while Lopez captioned the picture with a string of heart emojis.

Earlier this week, Lopez told People magazine of their relationship: “We’re really happy.

“Everything that we do, we do together.

View this post on Instagram

3.9.19✨♥️

A post shared by Jennifer Lopez (@jlo) on

“He knows my dreams and I know his dreams, and together we feel like we’re stronger.”

Lopez has twins Max and Emme from her previous marriage to Marc Anthony and Rodriguez is father to two girls.