They were resisting the 1947 UN partition at the time and the Nakba that followed it. Both sides were fighting illegal wars over the territory. Israel won. So it has a duty to govern its people as it laid out in its Declaration of Independence, the Declaration of the Establishment of the State of Israel:
"THE STATE OF ISRAEL will be open for Jewish immigration and for the Ingathering of the Exiles; it will foster the development of the country for the benefit of all its inhabitants; it will be based on freedom, justice and peace as envisaged by the prophets of Israel; it will ensure complete equality of social and political rights to all its inhabitants irrespective of religion, race or sex; it will guarantee freedom of religion, conscience, language, education and culture; it will safeguard the Holy Places of all religions; and it will be faithful to the principles of the Charter of the United Nations."
Today their Supreme Court holds this was never a legally binding document so laws that discriminate based on religion and race are permissible. They weren't then and shouldn't be now.