I've seen the viewpoint commonly expressed that while Israel is a strategic liability to the United States today, it was once useful in advancing cold war aims. This viewpoint is wrong. The contest between the United States and the Soviet Union was one in which the United States had huge initial advantages in the Middle East. The US' association with Israel was, in fact, the most important factor in creating openings for the Soviet Union in what otherwise would have been a tremendously hostile region to communism.
As background we have to remember that communism, as implemented by the Soviets and also the Chinese, is militantly atheistic. While the Middle East is probably the most religiously observant region in the world. All other things being equal, a communist power attempting to gain influence in the Middle East would find its view towards religion itself to be a serious obstacle to its objectives.
Of course, other things were not equal. All of the Middle East was, by the time Israel was founded, under the direct or indirect colonial rule of Britain and France, allies of the United States. This is a relationship that in many cases continues until this day with the role of colonial patron transferred to the United States. In terms of economic and social ties to the region, the West had a lead in the region that wound up being unassailable.
Israel, at its foundation as it is now, was rejected by its region, even by the indirect colonial leaders such as the kings of Jordan, Saudi Arabia and at that time the kings of Egypt and Iraq. The fact of the matter is that European colonial powers, especially Britain, decided to give a largely European population territory to form at homeland that at the time had a majority Arab population. The majority population of the territory was given no effective leverage over the decision or process by which their territory would be made into the homeland of another group.
It was reasonable, but even if you do not agree that it was reasonable, it happened that the people of the region, including the stooge dictators who ruled on behalf of the colonial powers, were united in their opposition to the formation of Israel. The opposition to Israel was transferred to opposition to the foreign supporters whose assistance was necessary in establishing and maintaining a majority state for the small population of Jewish people in Palestine.
From the beginning, the cost of Israel is that it has made the region more hostile against the West, which has been seen as Israel's primary source of support from before the 1956 joint Israeli/French/British attack on Egypt and against the United States which during the early cold war could not be seen as separate from its French and British primary allies. Here is Gamal Abdel Nasser speaking before the outbreak of the 1967 war:
Today people must know the reality of the Arab world. What is Israel? Israel today is the United States. The United States is the chief defender of Israel. As for Britain, I consider it America's lackey. Britain does not have an independent policy. Wilson always follows Johnson's steps and says what he wants him to say. All Western countries take Israel's view.I've read assertions that the United States had a somehow balanced policy regarding Israel before that war. While it is true that the US has increased its support since then, that in no way means that was no favoritism before. At least Nasser did not consider the US impartial before then.
In 1948, the United States could and should have either endorsed a local plebiscite that would give the people of the territory the right to determine whether and how the land would be divided or given the Arabs an effective right of refusal from which point negotiations could have produced a territorial allocation that would have been in line with the populations on the ground and not seen throughout the region as unfair in favor of Jewish people.
Using Nasser's Egypt as an example, had the US done not favored the Jewish people who would come to Palestine from the beginning, and had Nasser come to power, his turning to the Soviets would not have been conceivable. The idea that Israel was a counter-weight to Nasser misses the most important point. Nasser was not inherently anti-US. Nasser opposed the US only because he perceived the US as an essential support for Israel.
The argument that Israel has ever been helpful to the US always makes this mistake. It begins with a region mysteriously and unexplainably hostile to the US or the West and argues that Israel helps confront the region. The region would not have been hostile to the West in the first place other than for Israel. While Israel, at great cost, plays a role in fighting the region, a lot of that cost is carried outside of Israel. New York City lost its two tallest buildings to this regional hostility that is a reaction to Israel.