A small lunar lander crashed into the surface of the moon on Thursday, coming just short of the venture's goal.

Israeli nonprofit SpaceIL was aiming to become the first private entity to softly land a spacecraft on the moon's surface — a feat previously achieved by only three governments in history. SpaceIL confirmed that its robotic "Beresheet" spacecraft was not successful.

"We have a failure of the spacecraft. We unfortunately have not managed to land successfully," Opher Doron, general manager of the Israel Aerospace Industries space program, said on the SpaceIL's livestream of the landing attempt.

"If at first you don't succeed, try again," Israeli Prime Minister Benjamin Netanyahu said after the crash. He added the prediction that Israel will be successful in two or three years, as "an Israeli spacecraft will land on the moon, whole."

Beresheet is the Hebrew word for genesis, literally translating as "in the beginning." The spacecraft traveled for about 4 million miles before reaching the moon. The SpaceIL team showed an image of the spacecraft, taken at about 22 kilometers above the lunar surface as Beresheet began its final approach.

"We are the seventh country to orbit the moon and the fourth to reach the moon's surface," Doron said. "It's a tremendous achievement up to now."

The only other countries to reach the lunar surface before Israel are the United States, Russia and China. No private entity has safely landed a spacecraft on the moon.

Messages of condolence and congratulations poured in from around the world, as many still hailed the mission as a success for its ambition and accomplishments along the way.

"While NASA regrets the end of the TeamSpaceIL mission without a successful lunar landing, we congratulate SpaceIL, Israel Aerospace Industries and the state of Israel on the accomplishment of sending the first privately funded mission into lunar orbit," NASA Administrator Jim Bridenstine said in a tweet.

At a cost of about $100 million, the low-budget lander was backed by private donors, with state-owned Israel Aerospace Industries involved as a partner. SpaceIL president and billionaire entrepreneur Morris Kahn personally donated $40 million of the project's costs. While the mission's cost was higher than previously expected, Beresheet's mission came at a fraction of the multibillion-dollar costs of previous government projects.

The SpaceIL project was initially a competitor in the Google Lunar Xprize but that race ended last March with no winners. Although Google withdrew its $20 million prize, the Xprize Foundation had said it would give SpaceIL a $1 million award for the successful lunar landing. The Xprize founder, Peter Diamandis, said his organization would still award the SpaceIL team the $1 million so the team can "continue their work and pursue Beresheet 2.0."

SpaceX launched Beresheet as a secondary payload on a Falcon 9 rocket in February. The spacecraft traveled for nearly seven weeks before reaching the moon.

- CNBC's Jason Gewirtz contributed to this report.